Add options to pass arguments to initialiser
This commit is contained in:
@@ -52,14 +52,19 @@ type
|
|||||||
func initParserToken*(x: char): ParserToken = ParserToken(kind: parserTokenChar, charValue: x)
|
func initParserToken*(x: char): ParserToken = ParserToken(kind: parserTokenChar, charValue: x)
|
||||||
func initParserToken*(x: string): ParserToken = ParserToken(kind: parserTokenString, stringValue: x)
|
func initParserToken*(x: string): ParserToken = ParserToken(kind: parserTokenString, stringValue: x)
|
||||||
|
|
||||||
func initParser*(str: string): Parser =
|
func initParser*(
|
||||||
|
stream: string,
|
||||||
|
tokens = newSeq[ParserToken](),
|
||||||
|
position = -1,
|
||||||
|
lastPosition = 0,
|
||||||
|
): Parser =
|
||||||
Parser(
|
Parser(
|
||||||
state: ParserState(
|
state: ParserState(
|
||||||
stream: str,
|
stream: stream,
|
||||||
position: -1,
|
position: position,
|
||||||
lastPosition: 0,
|
lastPosition: lastPosition,
|
||||||
),
|
),
|
||||||
tokens: newSeq[ParserToken](),
|
tokens: tokens,
|
||||||
)
|
)
|
||||||
|
|
||||||
func initParserResult*(str: string): ParserResult =
|
func initParserResult*(str: string): ParserResult =
|
||||||
|
|||||||
Reference in New Issue
Block a user