func Parse(input string, options *ParseOptions) (*ast.Document, error) { source := ast.NewSource(input, "") parser, err := newParser(source, options) if err != nil { } return parseDocument(parser) }
func ParseValue(input string, options *ParseOptions) { source := ast.NewSource(input, "") parser, err := newParser(source, options) if err != nil { } return parseValueLiteral(parser) }
func TestDollar(t *testing.T) { source := ast.NewSource("$", "") result, err := Lex(source)(-1) expect(t, err, result, DOLLAR, 0, 1, "") }
func TestWhitespace(t *testing.T) { source := ast.NewSource("\n foo \n ", "") result, err := Lex(source)(-1) expect(t, err, result, NAME, 4, 7, "foo") }
func TestScience(t *testing.T) { source := ast.NewSource("123e+4", "") result, err := Lex(source)(-1) expect(t, err, result, FLOAT, 0, 6, "123e+4") }
func TestBang(t *testing.T) { source := ast.NewSource("!", "") result, err := Lex(source)(-1) expect(t, err, result, BANG, 0, 1, "") }
func TestNegative(t *testing.T) { source := ast.NewSource("-4", "") result, err := Lex(source)(-1) expect(t, err, result, INT, 0, 2, "-4") }
func TestDecimal(t *testing.T) { source := ast.NewSource("0.123", "") result, err := Lex(source)(-1) expect(t, err, result, FLOAT, 0, 5, "0.123") }
func TestSlashes(t *testing.T) { source := ast.NewSource("\"slashes \\\\ \\/\"", "") result, err := Lex(source)(-1) expect(t, err, result, STRING, 0, 15, "slashes \\ /") }
func TestInt(t *testing.T) { source := ast.NewSource("4", "") result, err := Lex(source)(-1) expect(t, err, result, INT, 0, 1, "4") }
func TestEscaped(t *testing.T) { source := ast.NewSource("\"escaped \\n\\r\\b\\t\\f\"", "") result, err := Lex(source)(-1) expect(t, err, result, STRING, 0, 20, "escaped \n\r\b\t\f") }
func TestQuotes(t *testing.T) { source := ast.NewSource("\"quote \\\"\"", "") result, err := Lex(source)(-1) expect(t, err, result, STRING, 0, 10, "quote \"") }
func TestWhitespaceString(t *testing.T) { source := ast.NewSource("\" white space \"", "") result, err := Lex(source)(-1) expect(t, err, result, STRING, 0, 15, " white space ") }
func TestSimpleString(t *testing.T) { source := ast.NewSource("\"simple\"", "") result, err := Lex(source)(-1) expect(t, err, result, STRING, 0, 8, "simple") }
func TestComments(t *testing.T) { source := ast.NewSource("#hello\nfoo#comment", "") result, err := Lex(source)(-1) expect(t, err, result, NAME, 7, 10, "foo") }