TextParser<'TPar>
The recursive descent parser class contains parsing state and serves as a base class for specific parsers implementations. The specific derived parser class needs to be specified as type parameter. It should also contain the state transition table as static member variables.
Constructors
Constructor | Description |
new()
Signature: unit -> unit
|
Instance members
Instance member | Description |
CurrentCase(state)
Signature: state:State<'TPar,'TNode> -> Case<'TPar,'TNode>
|
The current case within the supplied state table. This is only valid as long as no recursive parse function has been called. |
CurrentCaseIndex
Signature: int
|
The index of the current case within the state table. This is only valid as long as no recursive parse function has been called. |
CurrentPattern(state)
Signature: state:State<'TPar,'TNode> -> string
|
The current pattern within the supplied state table. This is only valid as long as no recursive parse function has been called. |
EndOfText
Signature: bool
|
True if parsing has consumed all input. |
Get()
Signature: unit -> Text
|
Get the text up to the end of the last pattern that was matched up to its start. This can either be the pattern of the case, the pattern that is left by one of the GetToStartOf(...), or the pattern that was left by one of the SkipToStartOf(...) methods. |
Get(rx)
Signature: rx:Rx -> Text
|
Get text that matches the supplied regular expression (it must start at the current position). If the text does not match, an exception is thrown. |
Get(rx, notMatchedFun)
Signature: (rx:Rx * notMatchedFun:Func<'TPar,Text>) -> Text
|
Get text that matches the supplied regular expression (it must start at the current position). If the text does not match, the supplied function is executed and its result is returned. |
GetChar()
Signature: unit -> char
|
Get one character of input. |
GetFrom(start)
Signature: start:int -> Text
|
Get the text from the supplied start up to the current parsing position. This can be used, if a number of patterns have been skipped before and need to be combined into a single text. |
GetList(item, sep)
Signature: (item:Rx * sep:Rx) -> List<Text>
|
|
GetTo(offset)
Signature: offset:int -> Text
|
Get text [pos, pos + offset) if offset is greater than 0, and text [pos, end + offset) if offset is lower or equal to 0. |
GetToEnd()
Signature: unit -> Text
|
|
GetToEndOf(searchChar)
Signature: searchChar:char -> Text
|
|
GetToEndOf(searchChar, notFoundFun)
Signature: (searchChar:char * notFoundFun:Func<'TPar,Text>) -> Text
|
|
GetToEndOf(searchString)
Signature: searchString:string -> Text
|
|
GetToEndOf(searchString, notFoundFun)
Signature: (searchString:string * notFoundFun:Func<'TPar,Text>) -> Text
|
|
GetToEndOf(searchRx)
Signature: searchRx:Rx -> Text
|
|
GetToEndOf(searchRx, notFoundFun)
Signature: (searchRx:Rx * notFoundFun:Func<'TPar,Text>) -> Text
|
|
GetToEndOfOrEnd(searchChar)
Signature: searchChar:char -> Text
|
|
GetToEndOfOrEnd(searchString)
Signature: searchString:string -> Text
|
|
GetToEndOfOrEnd(searchRx)
Signature: searchRx:Rx -> Text
|
|
GetToPos(pos)
Signature: pos:int -> Text
|
|
GetToStartOf(searchChar)
Signature: searchChar:char -> Text
|
|
GetToStartOf(searchChar, notFoundAction)
Signature: (searchChar:char * notFoundAction:Func<'TPar,Text>) -> Text
|
|
GetToStartOf(searchString)
Signature: searchString:string -> Text
|
|
GetToStartOf(...)
Signature: (searchString:string * notFoundAction:Func<'TPar,Text>) -> Text
|
|
GetToStartOf(searchRx)
Signature: searchRx:Rx -> Text
|
|
GetToStartOf(searchRx, notFoundAction)
Signature: (searchRx:Rx * notFoundAction:Func<'TPar,Text>) -> Text
|
|
GetToStartOfOrEnd(searchChar)
Signature: searchChar:char -> Text
|
|
GetToStartOfOrEnd(searchString)
Signature: searchString:string -> Text
|
|
GetToStartOfOrEnd(searchRx)
Signature: searchRx:Rx -> Text
|
|
GetToWhiteSpace()
Signature: unit -> Text
|
|
Peek
Signature: char
|
|
PeekFrom(offset)
Signature: offset:int -> Text
|
Returns the text [pos + offset, pos) if offset is lower than 0, and the text [start + offset, pos) if offset is greater or equal to 0. |
PeekFromPos(pos)
Signature: pos:int -> Text
|
|
PeekFromStart
Signature: Text
|
|
PeekGet()
Signature: unit -> Text
|
|
PeekLastLine
Signature: Text
|
|
PeekTo(offset)
Signature: offset:int -> Text
|
Returns the text [pos, pos + offset) if offset is greater than 0, and the text [pos, end + offset) if offset is lower or equal to 0. |
PeekToEnd
Signature: Text
|
|
PeekToPos(pos)
Signature: pos:int -> Text
|
|
SetPosAndCountLines(pos)
Signature: pos:int -> unit
|
|
Skip()
Signature: unit -> unit
|
Skip the last pattern that was matched up to its start. This can either be the pattern of the case, or the pattern that is left by one of the GetToStartOf(...) methods. |
Skip(count)
Signature: count:int -> unit
|
Skip exactly count characters. |
Skip(skipCh)
Signature: skipCh:char -> unit
|
|
Skip(skipStr)
Signature: skipStr:string -> unit
|
|
Skip(skipRx)
Signature: skipRx:Rx -> unit
|
|
SkipAndCountLines()
Signature: unit -> unit
|
|
SkipAndCountLines(count)
Signature: count:int -> unit
|
|
SkipToEnd()
Signature: unit -> unit
|
|
SkipToEndOf(searchChar)
Signature: searchChar:char -> unit
|
|
SkipToEndOf(searchString)
Signature: searchString:string -> unit
|
|
SkipToEndOf(searchRx)
Signature: searchRx:Rx -> unit
|
|
SkipToEndOfOrEnd(searchChar)
Signature: searchChar:char -> unit
|
|
SkipToEndOfOrEnd(searchString)
Signature: searchString:string -> unit
|
|
SkipToEndOfOrEnd(searchRx)
Signature: searchRx:Rx -> unit
|
|
SkipToStartOf(searchChar)
Signature: searchChar:char -> unit
|
|
SkipToStartOf(searchString)
Signature: searchString:string -> unit
|
|
SkipToStartOf(searchRx)
Signature: searchRx:Rx -> unit
|
|
SkipWhiteSpace()
Signature: unit -> int
|
Skip as much white space characters as possible. Returns the actual number skipped. |
SkipWhiteSpaceAndCheckProgress()
Signature: unit -> unit
|
|
SkipWhiteSpaceAtLeast(minimalCount)
Signature: minimalCount:int -> unit
|
Skip at least minimalCount white space characters. Throws a ParserException if less white space is available. |
ThrowCouldNotFind(str)
Signature: str:string -> Text
|
|
ThrowCouldNotSkip(str)
Signature: str:string -> Text
|
|
ThrowEndOfText()
Signature: unit -> unit
|
|
ThrowOutOfRange(typeName)
Signature: typeName:string -> unit
|
|
TryGet(ch)
Signature: ch:char -> bool
|
|
TryGet(str)
Signature: str:string -> bool
|
|
TryGetByte(parsedValue)
Signature: parsedValue:byref<ParsedValue<byte>> -> bool
|
|
TryGetDouble(parsedValue)
Signature: parsedValue:byref<ParsedValue<float>> -> bool
|
|
TryGetFloat(parsedValue)
Signature: parsedValue:byref<ParsedValue<float32>> -> bool
|
|
TryGetInt(parsedValue)
Signature: parsedValue:byref<ParsedValue<int>> -> bool
|
|
TryGetLong(parsedValue)
Signature: parsedValue:byref<ParsedValue<int64>> -> bool
|
|
TryGetSByte(parsedValue)
Signature: parsedValue:byref<ParsedValue<sbyte>> -> bool
|
|
TryGetShort(parsedValue)
Signature: parsedValue:byref<ParsedValue<int16>> -> bool
|
|
TryGetUInt(parsedValue)
Signature: parsedValue:byref<ParsedValue<uint32>> -> bool
|
|
TryGetULong(parsedValue)
Signature: parsedValue:byref<ParsedValue<uint64>> -> bool
|
|
TryGetUShort(parsedValue)
Signature: parsedValue:byref<ParsedValue<uint16>> -> bool
|
|
TrySkip(count)
Signature: count:int -> bool
|
|
TrySkip(skipCh)
Signature: skipCh:char -> bool
|
|
TrySkip(skipStr)
Signature: skipStr:string -> bool
|
|
TrySkip(skipRx)
Signature: skipRx:Rx -> bool
|
|
TrySkipToEndOf(searchChar)
Signature: searchChar:char -> bool
|
|
TrySkipToEndOf(searchString)
Signature: searchString:string -> bool
|
|
TrySkipToEndOf(searchRx)
Signature: searchRx:Rx -> bool
|
|
TrySkipToStartOf(searchChar)
Signature: searchChar:char -> bool
|
|
TrySkipToStartOf(searchString)
Signature: searchString:string -> bool
|
|
TrySkipToStartOf(searchRx)
Signature: searchRx:Rx -> bool
|
|
UserColumn
Signature: int
|
Users start counting at 1. |
UserLine
Signature: int
|
Users start counting at 1. |
Static members
Static member | Description |
Parse(text, parser, rootState, rootNode)
Signature: (text:Text * parser:'TPar * rootState:State<'TPar,'TNode> * rootNode:'TNode) -> 'TPar
|
Parse the supplied text into the supplied node, starting the parser in the supplied root state. This function is the entry call to the parser, it returns when the text has been fully parsed, or throws a ParserException. |
Parse(parser, state, node)
Signature: (parser:'TPar * state:State<'TPar,'TNode> * node:'TNode) -> 'TPar
|
Parse a part of the input into the supplied node. This function can be called to implement recursive descent. |