little cleanup for parsecfg module
This commit is contained in:
parent
ce23b814a0
commit
f686647f58
1 changed files with 1 additions and 5 deletions
|
|
@ -30,7 +30,7 @@ import
|
||||||
include "system/inclrtl"
|
include "system/inclrtl"
|
||||||
|
|
||||||
type
|
type
|
||||||
TCfgEventKind* = enum ## enumation of all events that may occur when parsing
|
TCfgEventKind* = enum ## enumeration of all events that may occur when parsing
|
||||||
cfgEof, ## end of file reached
|
cfgEof, ## end of file reached
|
||||||
cfgSectionStart, ## a ``[section]`` has been parsed
|
cfgSectionStart, ## a ``[section]`` has been parsed
|
||||||
cfgKeyValuePair, ## a ``key=value`` pair has been detected
|
cfgKeyValuePair, ## a ``key=value`` pair has been detected
|
||||||
|
|
@ -60,11 +60,8 @@ type
|
||||||
kind: TTokKind # the type of the token
|
kind: TTokKind # the type of the token
|
||||||
literal: string # the parsed (string) literal
|
literal: string # the parsed (string) literal
|
||||||
|
|
||||||
TParserState = enum
|
|
||||||
startState # , commaState # not yet used
|
|
||||||
TCfgParser* = object of TBaseLexer ## the parser object.
|
TCfgParser* = object of TBaseLexer ## the parser object.
|
||||||
tok: TToken
|
tok: TToken
|
||||||
state: TParserState
|
|
||||||
filename: string
|
filename: string
|
||||||
|
|
||||||
# implementation
|
# implementation
|
||||||
|
|
@ -82,7 +79,6 @@ proc open*(c: var TCfgParser, input: PStream, filename: string,
|
||||||
## number information in the generated error messages.
|
## number information in the generated error messages.
|
||||||
lexbase.open(c, input)
|
lexbase.open(c, input)
|
||||||
c.filename = filename
|
c.filename = filename
|
||||||
c.state = startState
|
|
||||||
c.tok.kind = tkInvalid
|
c.tok.kind = tkInvalid
|
||||||
c.tok.literal = ""
|
c.tok.literal = ""
|
||||||
inc(c.linenumber, lineOffset)
|
inc(c.linenumber, lineOffset)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue