Add org builder initializer
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import std/sugar
|
||||
import std/collections/sequtils
|
||||
import results
|
||||
import ./org_types
|
||||
import ../parser/parser_types
|
||||
|
||||
@@ -7,7 +7,11 @@ type OrgBuilderT* = OrgElement
|
||||
type OrgBuilder* = Builder[OrgBuilderT]
|
||||
type OrgBuilderResult* = BuilderResult[OrgBuilderT]
|
||||
|
||||
func makeOrgBuilderToken*(kind: orgElementKind): string -> OrgBuilderT =
|
||||
func initOrgBuilder*(content: string): OrgBuilderResult =
|
||||
return OrgBuilderResult.ok(OrgBuilder((
|
||||
parser: initParser(content),
|
||||
tree: newSeq[OrgBuilderT](),
|
||||
)))
|
||||
|
||||
func textTokenizer*(kind: orgElementKind): seq[ParserToken] -> seq[OrgBuilderT] =
|
||||
return func(tokens: seq[ParserToken]): seq[OrgBuilderT] =
|
||||
|
||||
@@ -51,7 +51,7 @@ type
|
||||
func initParserToken*(x: char): ParserToken = ParserToken(kind: parserTokenChar, charValue: x)
|
||||
func initParserToken*(x: string): ParserToken = ParserToken(kind: parserTokenString, stringValue: x)
|
||||
|
||||
proc initParser*(str: string): Parser =
|
||||
func initParser*(str: string): Parser =
|
||||
Parser(
|
||||
state: ParserState(
|
||||
stream: str,
|
||||
|
||||
Reference in New Issue
Block a user