Handle comments in N-Quad documents and REPL

The parser rejects an N-Quad with a comment, so we filter those out
ahead of time. This simplifies the grammar and code generated by the
parser.
This commit is contained in:
kortschak 2014-07-25 11:22:24 +09:30
parent dc17ccae80
commit d76213fb2d
3 changed files with 71 additions and 6 deletions

View file

@ -99,6 +99,11 @@ func Repl(ts graph.TripleStore, queryLanguage string, cfg *config.Config) error
if len(line) == 0 {
continue
}
line = bytes.TrimSpace(line)
if len(line) == 0 || line[0] == '#' {
line = line[:0]
continue
}
if bytes.HasPrefix(line, []byte(":debug")) {
ses.ToggleDebug()
fmt.Println("Debug Toggled")