Directory: lib/shiika_parser/
- Hand-written parser (i.e. no parser generator)
- Stateful lexer (to allow omission of method call parentheses)
File: lexer.rs
Lexer has a state (LexerState
). Main purpose of this is to decide operators like -
or +
is whether unary or binary.
/// - `p(-x)` # unary minus ExprBegin
/// - `p(- x)` # unary minus ExprBegin
/// - `p( - x)`# unary minus ExprBegin
/// - `p- x` # binary minus (unusual) ExprEnd
/// - `p-x` # binary minus ExprEnd
/// - `p - x` # binary minus ExprArg
/// - `p -x` # unary minus ExprArg
/// - `1 -2` # binary minus (unusual) ExprArg
This state is set by the parser.