dispatch/vendor/github.com/blevesearch/bleve/query_string.nex
2016-03-01 01:51:26 +01:00

41 lines
1.7 KiB
Plaintext

/\"((\\\")|(\\\\)|(\\\/)|(\\b)|(\\f)|(\\n)|(\\r)|(\\t)|(\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])|[^\"])*\"/ {
lval.s = yylex.Text()[1:len(yylex.Text())-1]
logDebugTokens("PHRASE - %s", lval.s);
return tPHRASE
}
/\+/ { logDebugTokens("PLUS"); return tPLUS }
/-/ { logDebugTokens("MINUS"); return tMINUS }
/:/ { logDebugTokens("COLON"); return tCOLON }
/\^/ { logDebugTokens("BOOST"); return tBOOST }
/\(/ { logDebugTokens("LPAREN"); return tLPAREN }
/\)/ { logDebugTokens("RPAREN"); return tRPAREN }
/>/ { logDebugTokens("GREATER"); return tGREATER }
/</ { logDebugTokens("LESS"); return tLESS }
/=/ { logDebugTokens("EQUAL"); return tEQUAL }
/~([0-9]|[1-9][0-9]*)/
{
lval.s = yylex.Text()[1:]
logDebugTokens("TILDENUMBER - %s", lval.s);
return tTILDENUMBER
}
/~/ { logDebugTokens("TILDE"); return tTILDE }
/-?([0-9]|[1-9][0-9]*)(\.[0-9][0-9]*)?/
{
lval.s = yylex.Text()
logDebugTokens("NUMBER - %s", lval.s);
return tNUMBER
}
/[ \t\n]+/ { logDebugTokens("WHITESPACE (count=%d)", len(yylex.Text())) /* eat up whitespace */ }
/[^\t\n\f\r :^\+\-><=~][^\t\n\f\r :^~]*/ {
lval.s = yylex.Text()
logDebugTokens("STRING - %s", lval.s);
return tSTRING
}
//
package bleve
func logDebugTokens(format string, v ...interface{}) {
if debugLexer {
logger.Printf(format, v...)
}
}