Package org.apache.lucene.queryparser.flexible.standard.parser

# Class StandardSyntaxParser

java.lang.Object
org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser

All Implemented Interfaces:
  `SyntaxParser`, `StandardSyntaxParserConstants`

public class StandardSyntaxParser extends Object implements SyntaxParser, StandardSyntaxParserConstants
Parser for the standard Lucene syntax

## Field Summary

Fields
Modifier and Type
Field
Description
`Token`
`jj_nt`
Next token.
`Token`
`token`
Current token.
`StandardSyntaxParserTokenManager`
`token_source`
Generated Token Manager.

### Fields inherited from interface org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParserConstants

`_ESCAPED_CHAR, _NUM_CHAR, _QUOTED_CHAR, _TERM_CHAR, _TERM_START_CHAR, _WHITESPACE, AFTER, AND, ATLEAST, BEFORE, CARAT, CONTAINED_BY, CONTAINING, DEFAULT, EOF, EXTEND, FN_OR, FN_PREFIX, Function, FUZZYTERM, LPAREN, MAXGAPS, MAXWIDTH, MINUS, NON_OVERLAPPING, NOT, NOT_CONTAINED_BY, NOT_CONTAINING, NOT_WITHIN, NUMBER, OP_COLON, OP_EQUAL, OP_LESSTHAN, OP_LESSTHANEQ, OP_MORETHAN, OP_MORETHANEQ, OR, ORDERED, OVERLAPPING, PHRASE, PLUS, QUOTED, Range, RANGE_GOOP, RANGE_QUOTED, RANGE_TO, RANGEEX_END, RANGEEX_START, RANGEIN_END, RANGEIN_START, REGEXPTERM, RPAREN, TERM, TILDE, tokenImage, UNORDERED, UNORDERED_NO_OVERLAPS, WILDCARD, WITHIN`

## Constructor Summary

Constructors
Constructor
Description
`StandardSyntaxParser()`
`StandardSyntaxParser(CharStream stream)`
Constructor with user supplied CharStream.
`StandardSyntaxParser(StandardSyntaxParserTokenManager tm)`
Constructor with generated Token Manager.

## Method Summary

Modifier and Type
Method
Description
`final void`
`disable_tracing()`
Disable tracing.
`final void`
`enable_tracing()`
Enable tracing.
`ParseException`
`generateParseException()`
Generate ParseException.
`final Token`
`getNextToken()`
Get the next Token.
`final Token`
`getToken(int index)`
Get the specific Token.
`QueryNode`
`parse(CharSequence query, CharSequence field)`
Parses a query string, returning a `QueryNode`.
`static float`
`parseFloat(Token token)`
`static int`
`parseInt(Token token)`
`void`
`ReInit(CharStream stream)`
Reinitialise.
`void`
`ReInit(StandardSyntaxParserTokenManager tm)`
Reinitialise.
`final QueryNode`
`TopLevelQuery(CharSequence field)`
`final boolean`
`trace_enabled()`
Trace enabled.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### token_source

public StandardSyntaxParserTokenManager token_source
Generated Token Manager.

### token

public Token token
Current token.

### jj_nt

public Token jj_nt
Next token.

## Constructor Details

### StandardSyntaxParser

public StandardSyntaxParser()

### StandardSyntaxParser

public StandardSyntaxParser(CharStream stream)
Constructor with user supplied CharStream.

### StandardSyntaxParser

public StandardSyntaxParser(StandardSyntaxParserTokenManager tm)
Constructor with generated Token Manager.

## Method Details

### parse

public QueryNode parse(CharSequence query, CharSequence field) throws QueryNodeParseException
Parses a query string, returning a `QueryNode`.

Specified by:
  `parse` in interface `SyntaxParser`
Parameters:
  `query` - the query string to be parsed.
  `field` - - default field name
Returns:
  QueryNode tree
Throws:
  `ParseException` - if the parsing fails
  `QueryNodeParseException`

### parseFloat

public static float parseFloat(Token token)

### parseInt

public static int parseInt(Token token)

### TopLevelQuery

public final QueryNode TopLevelQuery(CharSequence field) throws ParseException

Throws:
  `ParseException`

### ReInit

public void ReInit(CharStream stream)
Reinitialise.

### ReInit

public void ReInit(StandardSyntaxParserTokenManager tm)
Reinitialise.

### getNextToken

public final Token getNextToken()
Get the next Token.

### getToken

public final Token getToken(int index)
Get the specific Token.

### generateParseException

public ParseException generateParseException()
Generate ParseException.

### trace_enabled

public final boolean trace_enabled()
Trace enabled.

### enable_tracing

public final void enable_tracing()
Enable tracing.

### disable_tracing

public final void disable_tracing()
Disable tracing.