Commit Graph

10 Commits

Author SHA1 Message Date
378bcef40b Add comment skipping to lexer
* Comment and whitespace skipping is now handed by a regex
* Remove skip_whitespace and adv_char since they aren't used anymore
* Fix pos_text() to return a reference with the correct lifetime
* Add comment skipping tests

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-05-08 12:34:51 -04:00
1232eca64c Add function expression parsing
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-05-07 17:43:39 -04:00
44970dbf97 Add dot token
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-05-06 17:41:46 -04:00
7698e49baf cargo fmt
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-05-05 17:22:39 -04:00
5622eb96bc Add ObjBrace token
To distinguish between objects and code bodies, an object is delimited
by curly braces, prefixed with a percent sign. Ex:

    obj = %{
        key = value
    }

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-05-05 16:43:38 -04:00
a4f289fb53 Add more expressions to parser, add EOL and newline tokens
* Lexer recognizes semicolons as EOL tokens, and newline tokens
* Parser can be configured to ignore newlines (which is also used
  internally)
* Newlines are allowed in lists, tuples, and parenthesized expressions
* Add a bunch of tests for the new stuff

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-05-05 16:38:07 -04:00
d9edf21d16 Add expression parsing
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-05-02 18:42:01 -04:00
28d29c2270 Add parser and AST, remove some stuff from lexer
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-04-27 20:17:16 -04:00
ce97d90f9d Move lexer to use regex instead of hand-rolled lexing
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-04-27 19:50:46 -04:00
58421a0469 Initial commit with lexer
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-04-27 12:42:17 -04:00