Production: Number

Top  Previous  Next

Examples > Calculator > Production: Number


The Number production only consists of the terminal symbol  number ( ::= "\d+(\.\d*)?|\.\d+", see above) and an action, which translates the text, matched by the symbol, into a number:



{{ xd = stod(xState.str()); }}


This translation is made by a special function stod. stod can be read as an abbreviation of "string to double". A string is passed to the function and it returns a double-value. To memorize: xState.str() returns the text of the last recognized token. So stod makes for example the value 123.45 out of the text "123.45".



This page belongs to the TextTransformer Documentation

Home  Content  German