org.jruby.parser
Class DefaultRubyParser

java.lang.Object
  extended byorg.jruby.parser.DefaultRubyParser

public class DefaultRubyParser
extends java.lang.Object


Nested Class Summary
static class DefaultRubyParser.yyException
          thrown for irrecoverable syntax errors and stack overflow.
static interface DefaultRubyParser.yyInput
          must be implemented by a scanner object to supply input to the parser.
 
Field Summary
static int k__FILE__
           
static int k__LINE__
           
static int kALIAS
           
static int kAND
           
static int kBEGIN
           
static int kBREAK
           
static int kCASE
           
static int kCLASS
           
static int kDEF
           
static int kDEFINED
           
static int kDO
           
static int kDO_BLOCK
           
static int kDO_COND
           
static int kELSE
           
static int kELSIF
           
static int kEND
           
static int kENSURE
           
static int kFALSE
           
static int kFOR
           
static int kIF
           
static int kIF_MOD
           
static int kIN
           
static int klBEGIN
           
static int klEND
           
static int kMODULE
           
static int kNEXT
           
static int kNIL
           
static int kNOT
           
static int kOR
           
static int kREDO
           
static int kRESCUE
           
static int kRESCUE_MOD
           
static int kRETRY
           
static int kRETURN
           
static int kSELF
           
static int kSUPER
           
static int kTHEN
           
static int kTRUE
           
static int kUNDEF
           
static int kUNLESS
           
static int kUNLESS_MOD
           
static int kUNTIL
           
static int kUNTIL_MOD
           
static int kWHEN
           
static int kWHILE
           
static int kWHILE_MOD
           
static int kYIELD
           
static int tAMPER
           
static int tAMPER2
           
static int tANDOP
           
static int tAREF
           
static int tASET
           
static int tASSOC
           
static int tBACK_REF
           
static int tBACK_REF2
           
static int tBANG
           
static int tCARET
           
static int tCMP
           
static int tCOLON2
           
static int tCOLON3
           
static int tCONSTANT
           
static int tCVAR
           
static int tDIVIDE
           
static int tDOT
           
static int tDOT2
           
static int tDOT3
           
static int tEQ
           
static int tEQQ
           
static int tFID
           
static int tFLOAT
           
static int tGEQ
           
static int tGT
           
static int tGVAR
           
static int tIDENTIFIER
           
static int tINTEGER
           
static int tIVAR
           
static int tLAST_TOKEN
           
static int tLBRACE
           
static int tLBRACE_ARG
           
static int tLBRACK
           
static int tLCURLY
           
static int tLEQ
           
static int tLOWEST
           
static int tLPAREN
           
static int tLPAREN_ARG
           
static int tLPAREN2
           
static int tLSHFT
           
static int tLT
           
static int tMATCH
           
static int tMINUS
           
static int tNEQ
           
static int tNMATCH
           
static int tNTH_REF
           
static int tOP_ASGN
           
static int tOROP
           
static int tPERCENT
           
static int tPIPE
           
static int tPLUS
           
static int tPOW
           
static int tQWORDS_BEG
           
static int tRBRACK
           
static int tRCURLY
           
static int tREGEXP_BEG
           
static int tREGEXP_END
           
static int tRPAREN
           
static int tRSHFT
           
static int tSTAR
           
static int tSTAR2
           
static int tSTRING_BEG
           
static int tSTRING_CONTENT
           
static int tSTRING_DBEG
           
static int tSTRING_DVAR
           
static int tSTRING_END
           
static int tSYMBEG
           
static int tTILDE
           
static int tUMINUS
           
static int tUMINUS_NUM
           
static int tUPLUS
           
static int tWORDS_BEG
           
static int tXSTRING_BEG
           
protected static short[] yyCheck
           
protected static short[] yyDefRed
          parser tables.
protected static short[] yyDgoto
          parser tables.
static int yyErrorCode
           
protected static int yyFinal
          number of final state.
protected static short[] yyGindex
          parser tables.
protected static short[] yyLen
          parser tables.
protected static short[] yyLhs
          parser tables.
protected  int yyMax
          initial size and increment of the state/value stack [default 256].
protected static java.lang.String[] yyNames
          maps symbol value to printable name.
protected static short[] yyRindex
          parser tables.
protected static short[] yySindex
          parser tables.
protected static short[] yyTable
           
 
Constructor Summary
DefaultRubyParser()
           
 
Method Summary
 RubyParserResult parse(RubyParserConfiguration configuration, LexerSource source)
          The parse method use an lexer stream and parse it to an AST node structure
 void setWarnings(IRubyWarnings warnings)
           
protected  java.lang.Object yyDefault(java.lang.Object first)
          executed at the beginning of a reduce action.
 void yyerror(java.lang.String message)
          simplified error message.
 void yyerror(java.lang.String message, java.lang.String[] expected, java.lang.String found)
          (syntax) error message.
protected  java.lang.String[] yyExpecting(int state)
          computes list of expected tokens on error by tracing the tables.
 java.lang.Object yyparse(RubyYaccLexer yyLex)
          the generated parser.
 java.lang.Object yyparse(RubyYaccLexer yyLex, java.lang.Object ayydebug)
          the generated parser, with debugging messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kCLASS

public static final int kCLASS
See Also:
Constant Field Values

kMODULE

public static final int kMODULE
See Also:
Constant Field Values

kDEF

public static final int kDEF
See Also:
Constant Field Values

kUNDEF

public static final int kUNDEF
See Also:
Constant Field Values

kBEGIN

public static final int kBEGIN
See Also:
Constant Field Values

kRESCUE

public static final int kRESCUE
See Also:
Constant Field Values

kENSURE

public static final int kENSURE
See Also:
Constant Field Values

kEND

public static final int kEND
See Also:
Constant Field Values

kIF

public static final int kIF
See Also:
Constant Field Values

kUNLESS

public static final int kUNLESS
See Also:
Constant Field Values

kTHEN

public static final int kTHEN
See Also:
Constant Field Values

kELSIF

public static final int kELSIF
See Also:
Constant Field Values

kELSE

public static final int kELSE
See Also:
Constant Field Values

kCASE

public static final int kCASE
See Also:
Constant Field Values

kWHEN

public static final int kWHEN
See Also:
Constant Field Values

kWHILE

public static final int kWHILE
See Also:
Constant Field Values

kUNTIL

public static final int kUNTIL
See Also:
Constant Field Values

kFOR

public static final int kFOR
See Also:
Constant Field Values

kBREAK

public static final int kBREAK
See Also:
Constant Field Values

kNEXT

public static final int kNEXT
See Also:
Constant Field Values

kREDO

public static final int kREDO
See Also:
Constant Field Values

kRETRY

public static final int kRETRY
See Also:
Constant Field Values

kIN

public static final int kIN
See Also:
Constant Field Values

kDO

public static final int kDO
See Also:
Constant Field Values

kDO_COND

public static final int kDO_COND
See Also:
Constant Field Values

kDO_BLOCK

public static final int kDO_BLOCK
See Also:
Constant Field Values

kRETURN

public static final int kRETURN
See Also:
Constant Field Values

kYIELD

public static final int kYIELD
See Also:
Constant Field Values

kSUPER

public static final int kSUPER
See Also:
Constant Field Values

kSELF

public static final int kSELF
See Also:
Constant Field Values

kNIL

public static final int kNIL
See Also:
Constant Field Values

kTRUE

public static final int kTRUE
See Also:
Constant Field Values

kFALSE

public static final int kFALSE
See Also:
Constant Field Values

kAND

public static final int kAND
See Also:
Constant Field Values

kOR

public static final int kOR
See Also:
Constant Field Values

kNOT

public static final int kNOT
See Also:
Constant Field Values

kIF_MOD

public static final int kIF_MOD
See Also:
Constant Field Values

kUNLESS_MOD

public static final int kUNLESS_MOD
See Also:
Constant Field Values

kWHILE_MOD

public static final int kWHILE_MOD
See Also:
Constant Field Values

kUNTIL_MOD

public static final int kUNTIL_MOD
See Also:
Constant Field Values

kRESCUE_MOD

public static final int kRESCUE_MOD
See Also:
Constant Field Values

kALIAS

public static final int kALIAS
See Also:
Constant Field Values

kDEFINED

public static final int kDEFINED
See Also:
Constant Field Values

klBEGIN

public static final int klBEGIN
See Also:
Constant Field Values

klEND

public static final int klEND
See Also:
Constant Field Values

k__LINE__

public static final int k__LINE__
See Also:
Constant Field Values

k__FILE__

public static final int k__FILE__
See Also:
Constant Field Values

tIDENTIFIER

public static final int tIDENTIFIER
See Also:
Constant Field Values

tFID

public static final int tFID
See Also:
Constant Field Values

tGVAR

public static final int tGVAR
See Also:
Constant Field Values

tIVAR

public static final int tIVAR
See Also:
Constant Field Values

tCONSTANT

public static final int tCONSTANT
See Also:
Constant Field Values

tCVAR

public static final int tCVAR
See Also:
Constant Field Values

tNTH_REF

public static final int tNTH_REF
See Also:
Constant Field Values

tBACK_REF

public static final int tBACK_REF
See Also:
Constant Field Values

tSTRING_CONTENT

public static final int tSTRING_CONTENT
See Also:
Constant Field Values

tINTEGER

public static final int tINTEGER
See Also:
Constant Field Values

tFLOAT

public static final int tFLOAT
See Also:
Constant Field Values

tREGEXP_END

public static final int tREGEXP_END
See Also:
Constant Field Values

tUPLUS

public static final int tUPLUS
See Also:
Constant Field Values

tUMINUS

public static final int tUMINUS
See Also:
Constant Field Values

tUMINUS_NUM

public static final int tUMINUS_NUM
See Also:
Constant Field Values

tPOW

public static final int tPOW
See Also:
Constant Field Values

tCMP

public static final int tCMP
See Also:
Constant Field Values

tEQ

public static final int tEQ
See Also:
Constant Field Values

tEQQ

public static final int tEQQ
See Also:
Constant Field Values

tNEQ

public static final int tNEQ
See Also:
Constant Field Values

tGEQ

public static final int tGEQ
See Also:
Constant Field Values

tLEQ

public static final int tLEQ
See Also:
Constant Field Values

tANDOP

public static final int tANDOP
See Also:
Constant Field Values

tOROP

public static final int tOROP
See Also:
Constant Field Values

tMATCH

public static final int tMATCH
See Also:
Constant Field Values

tNMATCH

public static final int tNMATCH
See Also:
Constant Field Values

tDOT

public static final int tDOT
See Also:
Constant Field Values

tDOT2

public static final int tDOT2
See Also:
Constant Field Values

tDOT3

public static final int tDOT3
See Also:
Constant Field Values

tAREF

public static final int tAREF
See Also:
Constant Field Values

tASET

public static final int tASET
See Also:
Constant Field Values

tLSHFT

public static final int tLSHFT
See Also:
Constant Field Values

tRSHFT

public static final int tRSHFT
See Also:
Constant Field Values

tCOLON2

public static final int tCOLON2
See Also:
Constant Field Values

tCOLON3

public static final int tCOLON3
See Also:
Constant Field Values

tOP_ASGN

public static final int tOP_ASGN
See Also:
Constant Field Values

tASSOC

public static final int tASSOC
See Also:
Constant Field Values

tLPAREN

public static final int tLPAREN
See Also:
Constant Field Values

tLPAREN2

public static final int tLPAREN2
See Also:
Constant Field Values

tRPAREN

public static final int tRPAREN
See Also:
Constant Field Values

tLPAREN_ARG

public static final int tLPAREN_ARG
See Also:
Constant Field Values

tLBRACK

public static final int tLBRACK
See Also:
Constant Field Values

tRBRACK

public static final int tRBRACK
See Also:
Constant Field Values

tLBRACE

public static final int tLBRACE
See Also:
Constant Field Values

tLBRACE_ARG

public static final int tLBRACE_ARG
See Also:
Constant Field Values

tSTAR

public static final int tSTAR
See Also:
Constant Field Values

tSTAR2

public static final int tSTAR2
See Also:
Constant Field Values

tAMPER

public static final int tAMPER
See Also:
Constant Field Values

tAMPER2

public static final int tAMPER2
See Also:
Constant Field Values

tTILDE

public static final int tTILDE
See Also:
Constant Field Values

tPERCENT

public static final int tPERCENT
See Also:
Constant Field Values

tDIVIDE

public static final int tDIVIDE
See Also:
Constant Field Values

tPLUS

public static final int tPLUS
See Also:
Constant Field Values

tMINUS

public static final int tMINUS
See Also:
Constant Field Values

tLT

public static final int tLT
See Also:
Constant Field Values

tGT

public static final int tGT
See Also:
Constant Field Values

tPIPE

public static final int tPIPE
See Also:
Constant Field Values

tBANG

public static final int tBANG
See Also:
Constant Field Values

tCARET

public static final int tCARET
See Also:
Constant Field Values

tLCURLY

public static final int tLCURLY
See Also:
Constant Field Values

tRCURLY

public static final int tRCURLY
See Also:
Constant Field Values

tBACK_REF2

public static final int tBACK_REF2
See Also:
Constant Field Values

tSYMBEG

public static final int tSYMBEG
See Also:
Constant Field Values

tSTRING_BEG

public static final int tSTRING_BEG
See Also:
Constant Field Values

tXSTRING_BEG

public static final int tXSTRING_BEG
See Also:
Constant Field Values

tREGEXP_BEG

public static final int tREGEXP_BEG
See Also:
Constant Field Values

tWORDS_BEG

public static final int tWORDS_BEG
See Also:
Constant Field Values

tQWORDS_BEG

public static final int tQWORDS_BEG
See Also:
Constant Field Values

tSTRING_DBEG

public static final int tSTRING_DBEG
See Also:
Constant Field Values

tSTRING_DVAR

public static final int tSTRING_DVAR
See Also:
Constant Field Values

tSTRING_END

public static final int tSTRING_END
See Also:
Constant Field Values

tLOWEST

public static final int tLOWEST
See Also:
Constant Field Values

tLAST_TOKEN

public static final int tLAST_TOKEN
See Also:
Constant Field Values

yyErrorCode

public static final int yyErrorCode
See Also:
Constant Field Values

yyFinal

protected static final int yyFinal
number of final state.

See Also:
Constant Field Values

yyLhs

protected static final short[] yyLhs
parser tables. Order is mandated by jay.


yyLen

protected static final short[] yyLen
parser tables. Order is mandated by jay.


yyDefRed

protected static final short[] yyDefRed
parser tables. Order is mandated by jay.


yyDgoto

protected static final short[] yyDgoto
parser tables. Order is mandated by jay.


yySindex

protected static final short[] yySindex
parser tables. Order is mandated by jay.


yyRindex

protected static final short[] yyRindex
parser tables. Order is mandated by jay.


yyGindex

protected static final short[] yyGindex
parser tables. Order is mandated by jay.


yyTable

protected static final short[] yyTable

yyCheck

protected static final short[] yyCheck

yyNames

protected static final java.lang.String[] yyNames
maps symbol value to printable name.

See Also:
yyExpecting(int)

yyMax

protected int yyMax
initial size and increment of the state/value stack [default 256]. This is not final so that it can be overwritten outside of invocations of yyparse(org.jruby.lexer.yacc.RubyYaccLexer, java.lang.Object).

Constructor Detail

DefaultRubyParser

public DefaultRubyParser()
Method Detail

setWarnings

public void setWarnings(IRubyWarnings warnings)

yyerror

public void yyerror(java.lang.String message)
simplified error message.

See Also:
#yyerror(java.lang.String, java.lang.String[])

yyerror

public void yyerror(java.lang.String message,
                    java.lang.String[] expected,
                    java.lang.String found)
(syntax) error message. Can be overwritten to control message format.

Parameters:
message - text to be displayed.
expected - list of acceptable tokens, if available.

yyExpecting

protected java.lang.String[] yyExpecting(int state)
computes list of expected tokens on error by tracing the tables.

Parameters:
state - for which to compute the list.
Returns:
list of token names.

yyparse

public java.lang.Object yyparse(RubyYaccLexer yyLex,
                                java.lang.Object ayydebug)
                         throws java.io.IOException,
                                DefaultRubyParser.yyException
the generated parser, with debugging messages. Maintains a dynamic state and value stack.

Parameters:
yyLex - scanner.
Returns:
result of the last reduction, if any.
Throws:
DefaultRubyParser.yyException - on irrecoverable parse error.
java.io.IOException

yyDefault

protected java.lang.Object yyDefault(java.lang.Object first)
executed at the beginning of a reduce action. Used as $$ = yyDefault($1), prior to the user-specified action, if any. Can be overwritten to provide deep copy, etc.

Parameters:
first - value for $1, or null.
Returns:
first.

yyparse

public java.lang.Object yyparse(RubyYaccLexer yyLex)
                         throws java.io.IOException,
                                DefaultRubyParser.yyException
the generated parser. Maintains a dynamic state and value stack.

Parameters:
yyLex - scanner.
Returns:
result of the last reduction, if any.
Throws:
DefaultRubyParser.yyException - on irrecoverable parse error.
java.io.IOException

parse

public RubyParserResult parse(RubyParserConfiguration configuration,
                              LexerSource source)
The parse method use an lexer stream and parse it to an AST node structure



Copyright © 2002-2007 JRuby Team. All Rights Reserved.