use of antlr.NoViableAltException in project jasn1 by openmuc.
the class ASNParser method module_definition.
public final AsnModule module_definition() throws RecognitionException, TokenStreamException {
AsnModule module;
Token e = null;
Token i = null;
Token a = null;
module = new AsnModule();
AsnModuleIdentifier mid;
String s;
try {
// for error handling
{
mid = module_identifier();
if (inputState.guessing == 0) {
module.moduleIdentifier = mid;
}
}
match(DEFINITIONS_KW);
{
switch(LA(1)) {
case AUTOMATIC_KW:
case EXPLICIT_KW:
case IMPLICIT_KW:
{
{
switch(LA(1)) {
case EXPLICIT_KW:
{
e = LT(1);
match(EXPLICIT_KW);
if (inputState.guessing == 0) {
module.tagDefault = AsnModule.TagDefault.EXPLICIT;
}
break;
}
case IMPLICIT_KW:
{
i = LT(1);
match(IMPLICIT_KW);
if (inputState.guessing == 0) {
module.tagDefault = AsnModule.TagDefault.IMPLICIT;
}
break;
}
case AUTOMATIC_KW:
{
a = LT(1);
match(AUTOMATIC_KW);
if (inputState.guessing == 0) {
module.tagDefault = AsnModule.TagDefault.AUTOMATIC;
}
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
match(TAGS_KW);
if (inputState.guessing == 0) {
module.tag = true;
}
break;
}
case EXTENSIBILITY_KW:
case ASSIGN_OP:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
{
switch(LA(1)) {
case EXTENSIBILITY_KW:
{
match(EXTENSIBILITY_KW);
match(IMPLIED_KW);
if (inputState.guessing == 0) {
module.extensible = true;
}
break;
}
case ASSIGN_OP:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
match(ASSIGN_OP);
match(BEGIN_KW);
module_body(module);
match(END_KW);
} catch (RecognitionException ex) {
if (inputState.guessing == 0) {
reportError(ex);
recover(ex, _tokenSet_1);
} else {
throw ex;
}
}
return module;
}
use of antlr.NoViableAltException in project jasn1 by openmuc.
the class ASNParser method character_set.
public final String character_set() throws RecognitionException, TokenStreamException {
String s;
Token s1 = null;
Token s2 = null;
Token s3 = null;
Token s4 = null;
Token s5 = null;
Token s6 = null;
Token s7 = null;
Token s8 = null;
Token s9 = null;
Token s10 = null;
Token s11 = null;
Token s12 = null;
Token s13 = null;
Token s14 = null;
Token s15 = null;
Token s16 = null;
s = "";
try {
// for error handling
switch(LA(1)) {
case BMP_STR_KW:
{
{
s1 = LT(1);
match(BMP_STR_KW);
if (inputState.guessing == 0) {
s = s1.getText();
}
}
break;
}
case GENERALIZED_TIME_KW:
{
{
s2 = LT(1);
match(GENERALIZED_TIME_KW);
if (inputState.guessing == 0) {
s = s2.getText();
}
}
break;
}
case GENERAL_STR_KW:
{
{
s3 = LT(1);
match(GENERAL_STR_KW);
if (inputState.guessing == 0) {
s = s3.getText();
}
}
break;
}
case GRAPHIC_STR_KW:
{
{
s4 = LT(1);
match(GRAPHIC_STR_KW);
if (inputState.guessing == 0) {
s = s4.getText();
}
}
break;
}
case IA5_STRING_KW:
{
{
s5 = LT(1);
match(IA5_STRING_KW);
if (inputState.guessing == 0) {
s = s5.getText();
}
}
break;
}
case ISO646_STR_KW:
{
{
s6 = LT(1);
match(ISO646_STR_KW);
if (inputState.guessing == 0) {
s = s6.getText();
}
}
break;
}
case NUMERIC_STR_KW:
{
{
s7 = LT(1);
match(NUMERIC_STR_KW);
if (inputState.guessing == 0) {
s = s7.getText();
}
}
break;
}
case PRINTABLE_STR_KW:
{
{
s8 = LT(1);
match(PRINTABLE_STR_KW);
if (inputState.guessing == 0) {
s = s8.getText();
}
}
break;
}
case TELETEX_STR_KW:
{
{
s9 = LT(1);
match(TELETEX_STR_KW);
if (inputState.guessing == 0) {
s = s9.getText();
}
}
break;
}
case T61_STR_KW:
{
{
s10 = LT(1);
match(T61_STR_KW);
if (inputState.guessing == 0) {
s = s10.getText();
}
}
break;
}
case UNIVERSAL_STR_KW:
{
{
s11 = LT(1);
match(UNIVERSAL_STR_KW);
if (inputState.guessing == 0) {
s = s11.getText();
}
}
break;
}
case UTF8_STR_KW:
{
{
s12 = LT(1);
match(UTF8_STR_KW);
if (inputState.guessing == 0) {
s = s12.getText();
}
}
break;
}
case UTC_TIME_KW:
{
{
s13 = LT(1);
match(UTC_TIME_KW);
if (inputState.guessing == 0) {
s = "UtcTime";
}
}
break;
}
case VIDEOTEX_STR_KW:
{
{
s14 = LT(1);
match(VIDEOTEX_STR_KW);
if (inputState.guessing == 0) {
s = s14.getText();
}
}
break;
}
case VISIBLE_STR_KW:
{
{
s15 = LT(1);
match(VISIBLE_STR_KW);
if (inputState.guessing == 0) {
s = s15.getText();
}
}
break;
}
case OBJECT_DESCRIPTOR_KW:
{
{
s16 = LT(1);
match(OBJECT_DESCRIPTOR_KW);
if (inputState.guessing == 0) {
s = s16.getText();
}
}
break;
}
case TIME_KW:
{
{
match(TIME_KW);
if (inputState.guessing == 0) {
s = "Time";
}
}
break;
}
case DATE_KW:
{
{
match(DATE_KW);
if (inputState.guessing == 0) {
s = "Date";
}
}
break;
}
case TIME_OF_DAY_KW:
{
{
match(TIME_OF_DAY_KW);
if (inputState.guessing == 0) {
s = "TimeOfDay";
}
}
break;
}
case DATE_TIME_KW:
{
{
match(DATE_TIME_KW);
if (inputState.guessing == 0) {
s = "DateTime";
}
}
break;
}
case DURATION_KW:
{
{
match(DURATION_KW);
if (inputState.guessing == 0) {
s = "Duration";
}
}
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
} catch (RecognitionException ex) {
if (inputState.guessing == 0) {
reportError(ex);
recover(ex, _tokenSet_41);
} else {
throw ex;
}
}
return s;
}
use of antlr.NoViableAltException in project jasn1 by openmuc.
the class ASNParser method module_identifier.
public final AsnModuleIdentifier module_identifier() throws RecognitionException, TokenStreamException {
AsnModuleIdentifier mid;
Token md = null;
mid = new AsnModuleIdentifier();
AsnOidComponentList cmplst;
try {
// for error handling
{
{
md = LT(1);
match(UPPER);
if (inputState.guessing == 0) {
mid.name = md.getText();
}
}
{
switch(LA(1)) {
case L_BRACE:
{
{
cmplst = obj_id_comp_lst();
if (inputState.guessing == 0) {
mid.componentList = cmplst;
}
}
break;
}
case DEFINITIONS_KW:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
}
} catch (RecognitionException ex) {
if (inputState.guessing == 0) {
reportError(ex);
recover(ex, _tokenSet_2);
} else {
throw ex;
}
}
return mid;
}
use of antlr.NoViableAltException in project sonar-java by SonarSource.
the class ValidWhenParser method integer.
public final void integer() throws RecognitionException, TokenStreamException {
Token d = null;
Token h = null;
Token o = null;
switch(LA(1)) {
case DECIMAL_LITERAL:
{
d = LT(1);
match(DECIMAL_LITERAL);
argStack.push(Integer.decode(d.getText()));
break;
}
case HEX_LITERAL:
{
h = LT(1);
match(HEX_LITERAL);
argStack.push(Integer.decode(h.getText()));
break;
}
case OCTAL_LITERAL:
{
o = LT(1);
match(OCTAL_LITERAL);
argStack.push(Integer.decode(o.getText()));
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
use of antlr.NoViableAltException in project sonar-java by SonarSource.
the class ValidWhenParser method expr.
public final void expr() throws RecognitionException, TokenStreamException {
if ((LA(1) == LPAREN) && (_tokenSet_1.member(LA(2)))) {
match(LPAREN);
comparisonExpression();
match(RPAREN);
} else if ((LA(1) == LPAREN) && (LA(2) == LPAREN)) {
match(LPAREN);
joinedExpression();
match(RPAREN);
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
Aggregations