SyntaxDefinition
The trait to define a syntax
Attributes
- K
the Kind type
- T
the Token type
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Members list
Type members
Types
Type of a syntax in this context of SyntaxDefinition
the type of Kind of the parsing Tokens
the type of Kind of the parsing Tokens
Attributes
the type of parsing Tokens
the type of parsing Tokens
Attributes
Value members
Abstract methods
Concrete methods
A Syntax that accept a Token of the given Kind and applies
applies the function f
on the parsed Token
A Syntax that accept a Token of the given Kind and applies
applies the function f
on the parsed Token
Attributes
- B
the resulting type when parsing the given kind
- f
the partial function to apply to a parsed Token of the kind
- k
the kind of the Token to parse
A syntax that produce the parsed Token
of the given Kind
A syntax that produce the parsed Token
of the given Kind
Attributes
- k
the Kind of the Token to parse
A nullable sytnax which gives the given value on an empty sequence of Token
A nullable sytnax which gives the given value on an empty sequence of Token
Attributes
- B
the type of the value to produce
- e
the value to produce
The empty syntax, results in parsing failure
The empty syntax, results in parsing failure
Attributes
- B
the type of value that should be produced
The syntax the represent 0 or more repetition of the given syntax
The syntax the represent 0 or more repetition of the given syntax
Attributes
- A
the type of the syntax to repeat
- rep
the syntax to be repeated
The syntax the represent 1 or more repetition of the given syntax
The syntax the represent 1 or more repetition of the given syntax
Attributes
- A
the type of the syntax to repeat
- rep
the syntax to be repeated
Return a syntax that is a disjunction of the given syntaxes
Return a syntax that is a disjunction of the given syntaxes
Attributes
- A
the type of the disjunction syntaxes
- syntaxes
the syntax to create the disjunction from
- Example:
oneOf[X] (a,b,...,n) // can be seen as (a | b | ... | n | failure[X])
Define an optional syntax.
Define an optional syntax.
If the parsing succeed the value is of type Some[B]
Otherwise it is of type None
Attributes
Define a recursive Syntax
Define a recursive Syntax
Attributes
- B
the type of the parsed value
- syntax
the inner recursive syntax
The syntax the represent 1 or more repetition of the given
syntax rep
, each separated by a syntax sep
. The resulting
syntax is a sequence of rep
s
The syntax the represent 1 or more repetition of the given
syntax rep
, each separated by a syntax sep
. The resulting
syntax is a sequence of rep
s
Attributes
- A
the type of the syntax to repeat
- B
the type of the separator syntax
- rep
the syntax to be repeated
- sep
the separator syntax
The syntax the represent 0 or more repetition of the given
syntax rep
, each separated by a syntax sep
. The resulting
syntax is a sequence of rep
s
The syntax the represent 0 or more repetition of the given
syntax rep
, each separated by a syntax sep
. The resulting
syntax is a sequence of rep
s
Attributes
- A
the type of the syntax to repeat
- B
the type of the separator syntax
- rep
the syntax to be repeated
- sep
the separator syntax
Givens
Givens
a given IdCounter that gives unique ids to Syntaxes
a given IdCounter that gives unique ids to Syntaxes
Attributes
Extensions
Extensions
Syntax Sequence operator
Syntax Sequence operator
Returns a new syntax which is the sequence of syntaxes thiz
and then that
, prepend the parsed value of thiz
to the
sequence of value of that
Attributes
- that
second element of the sequence, values are prepended to
- thiz
first element of the sequence
Map this syntax of X
to a syntax of B
by applying the function f
on resulting the value
Map this syntax of X
to a syntax of B
by applying the function f
on resulting the value
Attributes
- B
the type of the resulting syntax
- f
the function applied on the parsed value
Upcase thiz
to a supertype B
of X
Upcase thiz
to a supertype B
of X
Attributes
- B
the supertype to upcast to
- Returns:
a new syntax with
B
as inner type
Syntax Disjunction operator
Syntax Disjunction operator
Returns a new syntax which is the disjunction of syntaxes thiz
and that
Attributes
- that
the other syntax of the disjunction
- thiz
a sytnax of the disjunction
Syntax Disjunction operator
Syntax Disjunction operator
Returns a new syntax which is the disjunction of syntaxes thiz
and that
Attributes
- that
the other syntax of the disjunction
- thiz
a sytnax of the disjunction
Syntax Sequence operator
Syntax Sequence operator
Returns a new syntax which is the sequence of syntaxes thiz
and then that
Attributes
- that
second element of the sequence
- thiz
first element of the sequence
Sequence operator, keeping the left value
Sequence operator, keeping the left value
Returns a new syntax which is the sequence of syntaxes thiz
and then that
, keeping only the value of thiz
.
Attributes
- that
second element of the sequence
- thiz
first element of the sequence
Sequence operator, keeping the right value
Sequence operator, keeping the right value
Returns a new syntax which is the sequence of syntaxes thiz
and then that
, keeping only the value of that
.
Attributes
- that
second element of the sequence
- thiz
first element of the sequence
Syntax Sequence operator
Syntax Sequence operator
Returns a new syntax which is the sequence of syntaxes thiz
and then that
, append the parsed value of that
to the
sequence of value of thiz
Attributes
- that
second element of the sequence
- thiz
first element of the sequence, values are appended to