ArgumentsParser class
Parses an function argument expression and:
- validates the result
- and converts the values to Arguments
Function arguments:
- Multiple arguments are separated with a comma, e.g. single argument:
cos(pi)
multiple arguments:volume(10,20,30)
- There are different types of arguments
- Positional Arguments: These are passed in the order the function defines them. e.g.:
volume(10, 20, 30)
- Named Arguments: You can specify which parameter you're assigning a value to, regardless of order. e.g.:
volume(l=30, h=10, w=20)
- Positional Arguments: These are passed in the order the function defines them. e.g.:
- Arguments can set a parameter only once
- You can mix positional arguments and named arguments, but positional arguments must come first
- Named arguments remove ambiguity: If you want to skip an optional argument or specify one out of order, you must name it explicitly
Argument values:
- must match the expected parameter type. e.g.
area(length='hello', width='world')
will result in a failure - may be a tag expression such as a variable, constant, operation, function, or combination. e.g.
cos(2*pi)
Constructors
-
ArgumentsParser.new({required ParserContext parserContext, required List<
Parameter> parameters, required SettableParser loopbackParser})
Properties
-
children
→ List<
Parser> -
Returns a list of directly referenced parsers.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- loopbackParser → SettableParser
-
final
-
parameters
→ List<
Parameter> -
final
- parserContext → ParserContext
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copy(
) → ArgumentsParser - Returns a shallow copy of the receiver.
-
fastParseOn(
String buffer, int position) → int -
Primitive method doing the actual parsing.
inherited
-
hasEqualChildren(
covariant Parser other, Set< Parser> seen) → bool -
Compare the children of two parsers.
inherited
-
hasEqualProperties(
covariant Parser other) → bool -
Compare the properties of two parsers.
inherited
-
isEqualTo(
Parser other, [Set< Parser> ? seen]) → bool -
Recursively tests for structural equality of two parsers.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parse(
String input, {int start = 0}) → Result< Arguments> -
Returns the parse result of the
input
.inherited -
parseOn(
Context context) → Result< Map< String, Expression< >Object> > - Primitive method doing the actual parsing.
-
replace(
Parser source, Parser target) → void -
Changes the receiver by replacing
source
withtarget
. Does nothing ifsource
does not exist inParser.children
.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited