Java Code Examples for org.antlr.v4.runtime.CharStream#EOF

The following examples show how to use org.antlr.v4.runtime.CharStream#EOF . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ANTLRIgnoreCaseStringStream.java    From PoseidonX with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int LA(int i)
{
    
    int returnChar = super.LA(i);
    if (returnChar == CharStream.EOF)
    {
        return returnChar;
    }
    else if (returnChar == 0)
    {
        return returnChar;
    }
    
    return Character.toUpperCase((char)returnChar);
}
 
Example 2
Source File: NbLexerCharStream.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private int read() {
    int result = li.read();
    if (result == LexerInput.EOF) {
        result = CharStream.EOF;
    }

    return result;
}
 
Example 3
Source File: CaseInsensitiveFileStream.java    From yql-plus with Apache License 2.0 5 votes vote down vote up
@Override
public int LA(int i) {
    if (i == 0) {
        return 0;
    }
    if (i < 0) {
        i++; // e.g., translate LA(-1) to use offset 0
    }

    if ((p + i - 1) >= n) {
        return CharStream.EOF;
    }
    return Character.toLowerCase(data[p + i - 1]);
}
 
Example 4
Source File: CaseInsensitiveInputStream.java    From yql-plus with Apache License 2.0 5 votes vote down vote up
@Override
public int LA(int i) {
    if (i == 0) {
        return 0;
    }
    if (i < 0) {
        i++; // e.g., translate LA(-1) to use offset 0
    }

    if ((p + i - 1) >= n) {
        return CharStream.EOF;
    }
    return Character.toLowerCase(data[p + i - 1]);
}
 
Example 5
Source File: CaseInsensitiveFileStream.java    From vespa with Apache License 2.0 5 votes vote down vote up
@Override
public int LA(int i) {
    if (i == 0) {
        return 0;
    }
    if (i < 0) {
        i++; // e.g., translate LA(-1) to use offset 0
    }

    if ((p + i - 1) >= n) {
        return CharStream.EOF;
    }
    return Character.toLowerCase(data[p + i - 1]);
}
 
Example 6
Source File: CaseInsensitiveInputStream.java    From vespa with Apache License 2.0 5 votes vote down vote up
@Override
public int LA(int i) {
    if (i == 0) {
        return 0;
    }
    if (i < 0) {
        i++; // e.g., translate LA(-1) to use offset 0
    }

    if ((p + i - 1) >= n) {
        return CharStream.EOF;
    }
    return Character.toLowerCase(data[p + i - 1]);
}
 
Example 7
Source File: SemanticPredicates.java    From groovy with Apache License 2.0 5 votes vote down vote up
public static boolean isFollowedByWhiteSpaces(CharStream cs) {
    for (int index = 1, c = cs.LA(index); !('\r' == c || '\n' == c || CharStream.EOF == c); index++, c = cs.LA(index)) {
        if (matches(String.valueOf((char) c), NONSPACES_PATTERN)) {
            return false;
        }
    }

    return true;
}
 
Example 8
Source File: HiveQLAnalyzer.java    From incubator-tajo with Apache License 2.0 5 votes vote down vote up
@Override
public int LA(int i) {

  int returnChar = super.LA(i);
  if (returnChar == CharStream.EOF) {
    return returnChar;
  } else if (returnChar == 0) {
    return returnChar;
  }

  return Character.toUpperCase((char) returnChar);
}