ehm: intermediate stuff

main
Antonio De Lucreziis 2 years ago
parent d230a73dd9
commit be72480f95

@ -32,10 +32,6 @@ Mini scripting language for querying the website "model".
true
false
-- shorter form
#t
#f
-- Lists
[1 2 3]

@ -71,6 +71,11 @@ type Quote struct {
Value Quotation `parser:"'#' @@"`
}
type PropertyAccess struct {
Receiver IdentifierOrParenthesis `parser:"@@"`
Accesses []IdentifierOrParenthesis `parser:"('.' @@)*"`
}
type Quotation interface{}
type ExpressionFactor interface{}
@ -81,6 +86,8 @@ type BinaryOperation struct {
Rhs Expression `parser:" @@ )?"`
}
type IdentifierOrParenthesis interface{}
var (
scriptLexer = lexer.MustSimple([]lexer.SimpleRule{
{Name: "Comment", Pattern: `--[^\n]*\n?`},
@ -128,6 +135,10 @@ var (
&Identifier{},
&ParenthesizedExpression{},
),
participle.Union[IdentifierOrParenthesis](
&Identifier{},
&ParenthesizedExpression{},
),
participle.UseLookahead(2),
)
)

Loading…
Cancel
Save