Extend mathematic operations support in the kmath-ast parser #120
@ -2,9 +2,10 @@ grammar ArithmeticsEvaluator;
|
|||||||
|
|||||||
|
|
||||||
fragment DIGIT: '0'..'9';
|
fragment DIGIT: '0'..'9';
|
||||||
fragment LETTER: 'a'..'z';
|
fragment LETTER: 'a'..'z';
|
||||||
What about uppercase letters? What about uppercase letters?
Added. Added.
|
|||||||
|
fragment CAPITAL_LETTER: 'A'..'Z'
|
||||||
`1.23e+3` generally + in exponent is generally allowed
Fixed Fixed
|
|||||||
fragment UNDERSCORE: '_';
|
fragment UNDERSCORE: '_';
|
||||||
|
|
||||||
ID: (LETTER | UNDERSCORE) (LETTER | UNDERSCORE | DIGIT)*;
|
ID: (LETTER | UNDERSCORE | CAPITAL_LETTER) (LETTER | UNDERSCORE | DIGIT | CAPITAL_LETTER)*;
|
||||||
`1.23e+3` generally + in exponent is generally allowed
Fixed Fixed
`1.23e+3` generally + in exponent is generally allowed
Fixed Fixed
|
|||||||
NUM: (DIGIT | '.')+ ([eE] MINUS? DIGIT+)?;
|
NUM: (DIGIT | '.')+ ([eE] MINUS? DIGIT+)?;
|
||||||
MUL: '*';
|
MUL: '*';
|
||||||
DIV: '/';
|
DIV: '/';
|
||||||
|
|||||||
`1.23e+3` generally + in exponent is generally allowed
`1.23e+3` generally + in exponent is generally allowed
Fixed Fixed
Fixed Fixed
|
@ -19,7 +19,7 @@ import scientifik.kmath.operations.SpaceOperations
|
|||||||
*/
|
*/
|
||||||
object ArithmeticsEvaluator : Grammar<MST>() {
|
object ArithmeticsEvaluator : Grammar<MST>() {
|
||||||
private val num: Token by token("[\\d.]+(?:[eE]-?\\d+)?".toRegex())
|
private val num: Token by token("[\\d.]+(?:[eE]-?\\d+)?".toRegex())
|
||||||
private val id: Token by token("[a-z_][\\da-z_]*".toRegex())
|
private val id: Token by token("[a-z_A-Z][\\da-z_A-Z]*".toRegex())
|
||||||
private val lpar: Token by token("\\(".toRegex())
|
private val lpar: Token by token("\\(".toRegex())
|
||||||
private val rpar: Token by token("\\)".toRegex())
|
private val rpar: Token by token("\\)".toRegex())
|
||||||
private val comma: Token by token(",".toRegex())
|
private val comma: Token by token(",".toRegex())
|
||||||
|
Loading…
Reference in New Issue
Block a user
1.23e+3
generally + in exponent is generally allowed1.23e+3
generally + in exponent is generally allowedFixed
Fixed