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 true
false false
-- shorter form
#t
#f
-- Lists -- Lists
[1 2 3] [1 2 3]

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

Loading…
Cancel
Save