Extend mathematic operations support in the kmath-ast parser #120

Merged
CommanderTvis merged 10 commits from extended-grammar into dev 2020-07-27 19:37:09 +03:00
2 changed files with 5 additions and 5 deletions
Showing only changes of commit a5499260fa - Show all commits

View File

@ -2,11 +2,11 @@ grammar ArithmeticsEvaluator;
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
fragment DIGIT: '0'..'9'; fragment DIGIT: '0'..'9';
fragment LETTER: 'a'..'z'; fragment LETTER: 'a'..'z';
Shimuuar commented 2020-07-27 11:02:15 +03:00 (Migrated from github.com)
Review

What about uppercase letters?

What about uppercase letters?
CommanderTvis commented 2020-07-27 16:51:53 +03:00 (Migrated from github.com)
Review

Added.

Added.
fragment CAPITAL_LETTER: 'A'..'Z' fragment CAPITAL_LETTER: 'A'..'Z';
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
fragment UNDERSCORE: '_'; fragment UNDERSCORE: '_';
ID: (LETTER | UNDERSCORE | CAPITAL_LETTER) (LETTER | UNDERSCORE | DIGIT | CAPITAL_LETTER)*; ID: (LETTER | UNDERSCORE | CAPITAL_LETTER) (LETTER | UNDERSCORE | DIGIT | CAPITAL_LETTER)*;
NUM: (DIGIT | '.')+ ([eE] MINUS? DIGIT+)?; NUM: (DIGIT | '.')+ ([eE] (MINUS? | PLUS?) DIGIT+)?;
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
MUL: '*'; MUL: '*';
DIV: '/'; DIV: '/';
PLUS: '+'; PLUS: '+';
@ -17,7 +17,7 @@ LPAR: '(';
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
RPAR: ')'; RPAR: ')';
WS: [ \n\t\r]+ -> skip; WS: [ \n\t\r]+ -> skip;
number num
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
: NUM : NUM
; ;
@ -34,7 +34,7 @@ binaryFunction
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
; ;
term term
: number : num
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
| singular | singular
| unaryFunction | unaryFunction
| binaryFunction | binaryFunction

Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
Shimuuar commented 2020-07-27 11:02:43 +03:00 (Migrated from github.com)
Review

1.23e+3 generally + in exponent is generally allowed

`1.23e+3` generally + in exponent is generally allowed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed
CommanderTvis commented 2020-07-27 16:51:45 +03:00 (Migrated from github.com)
Review

Fixed

Fixed

View File

@ -18,7 +18,7 @@ import scientifik.kmath.operations.SpaceOperations
* TODO move to common * TODO move to common
*/ */
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_A-Z][\\da-z_A-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())