Add stdlib documentation
This commit is contained in:
@@ -1684,7 +1684,7 @@ using `--tokens` flag, for example:
|
|||||||
```
|
```
|
||||||
$ smnp --tokens --dry-run -c "[1, 2, 3] as i ^ println(\"Current: \" + i.toString());"
|
$ smnp --tokens --dry-run -c "[1, 2, 3] as i ^ println(\"Current: \" + i.toString());"
|
||||||
[Current(0): {OPEN_SQUARE, '[', (0, 0)}
|
[Current(0): {OPEN_SQUARE, '[', (0, 0)}
|
||||||
{OPEN_SQUARE, '[', (0, 0)}, {INTEGER, '1', (0, 1)}, {COMMA, ',', (0, 2)}, {INTEGER, '2', (0, 4)}, {COMMA, ',', (0, 5)}, {INTEGER, '3', (0, 7)}, {CLOSE_SQUARE, ']', (0, 8)}, {AS, 'as', (0, 10)}, {IDENTIFIER, 'i', (0, 13)}, {DASH, '^', (0, 15)}, {IDENTIFIER, 'println', (0, 17)}, {OPEN_PAREN, '(', (0, 24)}, {STRING, 'Current: ', (0, 25)}, {PLUS, '+', (0, 37)}, {IDENTIFIER, 'i', (0, 39)}, {DOT, '.', (0, 40)}, {IDENTIFIER, 'toString', (0, 41)}, {OPEN_PAREN, '(', (0, 49)}, {CLOSE_PAREN, ')', (0, 50)}, {CLOSE_PAREN, ')', (0, 51)}, {SEMICOLON, ';', (0, 52)}]
|
{OPEN_SQUARE, '[', (0, 0)}, {INTEGER, '1', (0, 1)}, {COMMA, ',', (0, 2)}, {INTEGER, '2', (0, 4)}, {COMMA, ',', (0, 5)}, {INTEGER, '3', (0, 7)}, {CLOSE_SQUARE, ']', (0, 8)}, {AS, 'as', (0, 10)}, {IDENTIFIER, 'i', (0, 13)}, {CARET, '^', (0, 15)}, {IDENTIFIER, 'println', (0, 17)}, {OPEN_PAREN, '(', (0, 24)}, {STRING, 'Current: ', (0, 25)}, {PLUS, '+', (0, 37)}, {IDENTIFIER, 'i', (0, 39)}, {DOT, '.', (0, 40)}, {IDENTIFIER, 'toString', (0, 41)}, {OPEN_PAREN, '(', (0, 49)}, {CLOSE_PAREN, ')', (0, 50)}, {CLOSE_PAREN, ')', (0, 51)}, {SEMICOLON, ';', (0, 52)}]
|
||||||
```
|
```
|
||||||
|
|
||||||
Tokenizer tries to match input with all available patterns, sticking
|
Tokenizer tries to match input with all available patterns, sticking
|
||||||
|
|||||||
BIN
img/plots/c.png
Normal file
BIN
img/plots/c.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
BIN
img/plots/spectrum.png
Normal file
BIN
img/plots/spectrum.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -113,11 +113,11 @@ def LoopParser(input):
|
|||||||
return Parser.allOf(
|
return Parser.allOf(
|
||||||
ExpressionWithoutLoopParser,
|
ExpressionWithoutLoopParser,
|
||||||
Parser.optional(loopParameters),
|
Parser.optional(loopParameters),
|
||||||
Parser.terminal(TokenType.DASH, createNode=Operator.withValue),
|
Parser.terminal(TokenType.CARET, createNode=Operator.withValue),
|
||||||
StatementParser,
|
StatementParser,
|
||||||
Parser.optional(loopFilter),
|
Parser.optional(loopFilter),
|
||||||
createNode=Loop.loop,
|
createNode=Loop.loop,
|
||||||
name="dash-loop"
|
name="caret-loop"
|
||||||
)(input)
|
)(input)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ def getValueAccordingToType(value, type):
|
|||||||
|
|
||||||
raise ValueError()
|
raise ValueError()
|
||||||
|
|
||||||
raise RuntimeException(f"Type {type.value.name.lower()} is not suuported", None)
|
raise RuntimeException(f"Type {type.value.name.lower()} is not supported", None)
|
||||||
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise RuntimeException(f"Invalid value '{value}' for type {type.value.name.lower()}", None)
|
raise RuntimeException(f"Invalid value '{value}' for type {type.value.name.lower()}", None)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ tokenizers = (
|
|||||||
defaultTokenizer(TokenType.SLASH),
|
defaultTokenizer(TokenType.SLASH),
|
||||||
defaultTokenizer(TokenType.MINUS),
|
defaultTokenizer(TokenType.MINUS),
|
||||||
defaultTokenizer(TokenType.PLUS),
|
defaultTokenizer(TokenType.PLUS),
|
||||||
defaultTokenizer(TokenType.DASH),
|
defaultTokenizer(TokenType.CARET),
|
||||||
defaultTokenizer(TokenType.DOTS),
|
defaultTokenizer(TokenType.DOTS),
|
||||||
defaultTokenizer(TokenType.AMP),
|
defaultTokenizer(TokenType.AMP),
|
||||||
defaultTokenizer(TokenType.DOT),
|
defaultTokenizer(TokenType.DOT),
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class TokenType(Enum):
|
|||||||
SLASH = '/'
|
SLASH = '/'
|
||||||
MINUS = '-'
|
MINUS = '-'
|
||||||
PLUS = '+'
|
PLUS = '+'
|
||||||
DASH = '^'
|
CARET = '^'
|
||||||
DOTS = '...'
|
DOTS = '...'
|
||||||
AMP = '&'
|
AMP = '&'
|
||||||
DOT = '.'
|
DOT = '.'
|
||||||
|
|||||||
Reference in New Issue
Block a user