ehm: intermediate stuff
This commit is contained in:
@@ -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),
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user