This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package dora | |
import ( | |
"fmt" | |
"strconv" | |
) | |
// The available accessTypes for a dora query | |
const ( | |
ObjectAccess accessType = iota |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/bradford-hamilton/dora/pkg/dora" | |
) | |
const testJSONObject = `{ | |
"item1": ["aryitem1", "aryitem2", {"some": {"thing": "coolObj"}}], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Package ast TODO: package docs | |
package ast | |
// These are the available root node types. In JSON it will either be an | |
// object or an array at the base. | |
const ( | |
ObjectRoot RootNodeType = iota | |
ArrayRoot | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Package parser TODO | |
package parser | |
import ( | |
"errors" | |
"fmt" | |
"strconv" | |
"strings" | |
"github.com/bradford-hamilton/dora/pkg/ast" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<JSON> ::= <value> | |
<value> ::= <object> | <array> | <boolean> | <string> | <number> | <null> | |
<array> ::= "[" [ <value> *(', ' <value>) ] "]" | |
<object> ::= "{" [ <property> *(', ' <property>) ] "}" | |
<property> ::= <string> ":" <value> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lexer | |
import ( | |
"github.com/bradford-hamilton/dora/pkg/token" | |
) | |
// Lexer performs lexical analysis/scanning of the JSON | |
type Lexer struct { | |
Input []rune | |
char rune // current char under examination |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// All the different tokens for supporting JSON | |
const ( | |
// Token/character we don't know about | |
Illegal Type = "ILLEGAL" | |
// End of file | |
EOF Type = "EOF" | |
// Literals | |
String Type = "STRING" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Token is a struct representing a JSON token - It holds information like its Type and Literal, as well | |
// as Start, End, and Line fields. Line is used for better error handling, while Start and End are used | |
// to return objects/arrays from querys. | |
type Token struct { | |
Type Type | |
Literal string | |
Line int | |
Start int | |
End int | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"strings" | |
"github.com/aws/aws-sdk-go/aws" | |
"github.com/aws/aws-sdk-go/aws/credentials" | |
"github.com/aws/aws-sdk-go/aws/session" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"reflect" | |
"strconv" | |
"testing" | |
) | |
// benchmarkisPointerTypeAssertion 31.2 ns/op |