MCPcopy Index your code
hub / github.com/beanshell/beanshell / Literal

Method Literal

src/bsh/Parser.java:2348–2482  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2346 }
2347
2348 final public void Literal() throws ParseException {
2349 /*@bgen(jjtree) Literal */
2350 BSHLiteral jjtn000 = new BSHLiteral(JJTLITERAL);
2351 boolean jjtc000 = true;
2352 jjtree.openNodeScope(jjtn000);
2353 jjtreeOpenNodeScope(jjtn000);Token x;
2354 boolean b;
2355 String literal;
2356 char ch;
2357 try {
2358 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2359 case INTEGER_LITERAL:
2360 x = jj_consume_token(INTEGER_LITERAL);
2361 jjtree.closeNodeScope(jjtn000, true);
2362 jjtc000 = false;
2363 jjtreeCloseNodeScope(jjtn000);
2364 literal = x.image;
2365 ch = literal.charAt(literal.length()-1);
2366 if(ch == 'l' || ch == 'L')
2367 {
2368 literal = literal.substring(0,literal.length()-1);
2369 try {
2370 jjtn000.value = new Primitive( parseLong(literal) );
2371 } catch ( NumberFormatException e ) {
2372 {if (true) throw createParseException( e.getMessage(), e );}
2373 }
2374 }
2375 else
2376 try {
2377 jjtn000.value = new Primitive( parseInt(literal) );
2378 } catch ( NumberFormatException e ) {
2379 {if (true) throw createParseException( e.getMessage(), e );}
2380 }
2381 break;
2382 case FLOATING_POINT_LITERAL:
2383 x = jj_consume_token(FLOATING_POINT_LITERAL);
2384 jjtree.closeNodeScope(jjtn000, true);
2385 jjtc000 = false;
2386 jjtreeCloseNodeScope(jjtn000);
2387 literal = x.image;
2388 ch = literal.charAt(literal.length()-1);
2389 if(ch == 'f' || ch == 'F')
2390 {
2391 literal = literal.substring(0,literal.length()-1);
2392 jjtn000.value = new Primitive( new Float( literal ).floatValue() );
2393 }
2394 else
2395 {
2396 if(ch == 'd' || ch == 'D')
2397 literal = literal.substring(0,literal.length()-1);
2398
2399 jjtn000.value = new Primitive( new Double( literal ).doubleValue() );
2400 }
2401 break;
2402 case CHARACTER_LITERAL:
2403 x = jj_consume_token(CHARACTER_LITERAL);
2404 jjtree.closeNodeScope(jjtn000, true);
2405 jjtc000 = false;

Callers 2

CastLookaheadMethod · 0.95
PrimaryPrefixMethod · 0.95

Calls 15

jjtreeOpenNodeScopeMethod · 0.95
jj_ntkMethod · 0.95
jj_consume_tokenMethod · 0.95
jjtreeCloseNodeScopeMethod · 0.95
parseLongMethod · 0.95
createParseExceptionMethod · 0.95
parseIntMethod · 0.95
charSetupMethod · 0.95
stringSetupMethod · 0.95
BooleanLiteralMethod · 0.95
NullLiteralMethod · 0.95
VoidLiteralMethod · 0.95

Tested by

no test coverage detected