Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Lexer = lexer.Rules{ "Root": { { Name: "Whitespace", Pattern: `\s+`, }, { Name: "DoubleQuotedString", Pattern: `"`, Action: lexer.Push("DoubleQuotedString"), }, { Name: "SingleQuotedString", Pattern: `'`, Action: lexer.Push("SingleQuotedString"), }, { Name: "JSON", Pattern: `{`, Action: lexer.Push("JSON"), }, { Name: "Terminator", Pattern: `;`, }, { Name: "Equals", Pattern: `=`, }, { Name: "String", Pattern: `[^;="'\s]+`, }, }, "DoubleQuotedString": { { Name: "Escaped", Pattern: `\\(?:["\\abfnrtv]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})`, }, { Name: "DoubleQuotedStringEnd", Pattern: `"`, Action: lexer.Pop(), }, { Name: "DoubleQuotedChars", Pattern: `[^"\\]+`, }, }, "SingleQuotedString": { { Name: "SingleQuotedStringEnd", Pattern: `'`, Action: lexer.Pop(), }, { Name: "SingleQuotedChars", Pattern: `[^']+`, }, }, "JSON": { { Name: "JSONEnd", Pattern: `}`, Action: lexer.Pop(), }, { Name: "Whitespace", Pattern: `\s+`, }, { Name: "DoubleQuotedString", Pattern: `"`, Action: lexer.Push("DoubleQuotedString"), }, { Name: "Colon", Pattern: `:`, }, { Name: "Comma", Pattern: `,`, }, }, }
Functions ¶
This section is empty.
Types ¶
type DoubleQuoted ¶
type DoubleQuoted struct { Start string `parser:"@DoubleQuotedString"` Parts []DoubleQuotedPart `parser:"@@+"` End string `parser:"@DoubleQuotedStringEnd"` }
func (*DoubleQuoted) String ¶
func (s *DoubleQuoted) String() string
type DoubleQuotedPart ¶
type JSON ¶
type JSON struct { Start string `parser:"@JSON"` Pairs []TerminatedJSONPair `parser:"@@*"` End string `parser:"@JSONEnd"` }
type JSONPair ¶
type JSONPair struct { Key DoubleQuoted `parser:"@@"` Colon string `parser:"@Colon"` Value DoubleQuoted `parser:"@@"` }
type SingleQuoted ¶
type Str ¶
type Str struct { Literal string `parser:"(@String"` DoubleQuoted *DoubleQuoted `parser:"| @@"` SingleQuoted *SingleQuoted `parser:"| @@)"` }
type TerminatedJSONPair ¶
type TerminatedJSONPair struct { Key DoubleQuoted `parser:"@@"` Colon string `parser:"@Colon"` Value DoubleQuoted `parser:"@@"` Comma string `parser:"@Comma?"` }
Click to show internal directories.
Click to hide internal directories.