Skip to content

Commit 4d2f29a

Browse files
parsing a new extension operator
1 parent 077c909 commit 4d2f29a

File tree

14 files changed

+2776
-2075
lines changed

14 files changed

+2776
-2075
lines changed

validator/ast/ast.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ type Pattern struct {
8282
Contains *Contains `json:"Contains,omitempty"`
8383
Optional *Optional `json:"Optional,omitempty"`
8484
Interleave *Interleave `json:"Interleave,omitempty"`
85+
Extension *Extension `json:"Extension,omitempty"`
8586
}
8687

8788
func (m *Pattern) GetEmpty() *Empty {
@@ -215,6 +216,9 @@ func (this *Pattern) GetValue() interface{} {
215216
if this.Interleave != nil {
216217
return this.Interleave
217218
}
219+
if this.Extension != nil {
220+
return this.Extension
221+
}
218222
return nil
219223
}
220224

@@ -426,6 +430,32 @@ func (m *Interleave) GetRightPattern() *Pattern {
426430
return nil
427431
}
428432

433+
// Extension is the ast node for the Extension pattern.
434+
type Extension struct {
435+
Dollar *Keyword `json:"Dollar,omitempty"`
436+
Name string `json:"Name"`
437+
OpenParen *Keyword `json:"OpenParen,omitempty"`
438+
LeftPattern *Pattern `json:"LeftPattern,omitempty"`
439+
Comma *Keyword `json:"Comma,omitempty"`
440+
RightPattern *Pattern `json:"RightPattern,omitempty"`
441+
ExtraComma *Keyword `json:"ExtraComma,omitempty"`
442+
CloseParen *Keyword `json:"CloseParen,omitempty"`
443+
}
444+
445+
func (m *Extension) GetLeftPattern() *Pattern {
446+
if m != nil {
447+
return m.LeftPattern
448+
}
449+
return nil
450+
}
451+
452+
func (m *Extension) GetRightPattern() *Pattern {
453+
if m != nil {
454+
return m.RightPattern
455+
}
456+
return nil
457+
}
458+
429459
// Expr is a union of all possible expression types, terminal, list, function and builtin function.
430460
type Expr struct {
431461
RightArrow *Keyword `json:"RightArrow,omitempty"`

0 commit comments

Comments
 (0)