public boolean peek(int c) { return peek(c, 0); }
public boolean peek(int c) { return peek(c, 0); }
public void parser_prepare() { int c = nextc(); switch(c) { case '#': if (peek('!')) has_shebang = true; break; case 0xef: if (lex_pend - lex_p >= 2 && p(lex_p) == 0xbb && p(lex_p + 1) == 0xbf) { setEncoding(UTF8_ENCODING); lex_p += 2; lex_pbeg = lex_p; return; } break; case EOF: return; } pushback(c); current_enc = lex_lastline.getEncoding(); }
public void parser_prepare() { int c = nextc(); switch(c) { case '#': if (peek('!')) has_shebang = true; break; case 0xef: if (lex_pend - lex_p >= 2 && p(lex_p) == 0xbb && p(lex_p + 1) == 0xbf) { setEncoding(UTF8_ENCODING); lex_p += 2; lex_pbeg = lex_p; return; } break; case EOF: return; } pushback(c); current_enc = lex_lastline.getEncoding(); }
protected int numberLiteralSuffix(int mask) throws IOException { int c = nextc(); if (c == 'i') return (mask & SUFFIX_I) != 0 ? mask & SUFFIX_I : 0; if (c == 'r') { int result = 0; if ((mask & SUFFIX_R) != 0) result |= (mask & SUFFIX_R); if (peek('i') && (mask & SUFFIX_I) != 0) { c = nextc(); result |= (mask & SUFFIX_I); } return result; } if (c == '.') { int c2 = nextc(); if (Character.isDigit(c2)) { compile_error("unexpected fraction part after numeric literal"); do { // Ripper does not stop so we follow MRI here and read over next word... c2 = nextc(); } while (isIdentifierChar(c2)); } else { pushback(c2); } } pushback(c); return 0; }
protected int numberLiteralSuffix(int mask) throws IOException { int c = nextc(); if (c == 'i') return (mask & SUFFIX_I) != 0 ? mask & SUFFIX_I : 0; if (c == 'r') { int result = 0; if ((mask & SUFFIX_R) != 0) result |= (mask & SUFFIX_R); if (peek('i') && (mask & SUFFIX_I) != 0) { c = nextc(); result |= (mask & SUFFIX_I); } return result; } if (c == '.') { int c2 = nextc(); if (Character.isDigit(c2)) { compile_error("unexpected fraction part after numeric literal"); do { // Ripper does not stop so we follow MRI here and read over next word... c2 = nextc(); } while (isIdentifierChar(c2)); } else { pushback(c2); } } pushback(c); return 0; }