system/src/sc/parser/Parser.java
public int peekInputStr(ArrString expectedValue, boolean negated, boolean ignoreCase) {
      int relIx = currentIndex - currentBufferPos;
      if (relIx < 0)
         throw new IllegalArgumentException("Attempt to access character before the current buffer position");

      char[] expectedBuf = expectedValue.buf;
      int expectedLen = expectedBuf.length;
      if (relIx+expectedLen <= bufSize) {
         if (ignoreCase) {
            for (int i = 0; i < expectedLen; i++) {
               if (Character.toLowerCase(inputBuffer[relIx++]) != Character.toLowerCase(expectedBuf[i]))
                  return negated ? 0 : 1;
            }
         }
         else {
            for (int i = 0; i < expectedLen; i++) {
               if (inputBuffer[relIx++] != expectedBuf[i])
                  return negated ? 0 : 1;
            }
         }
         return !negated ? 0 : 1;
      }
      else {
         if (!eof) {
            while (relIx + expectedLen >= inputBuffer.length)
               growBuffer();
            fillBuffer();
         }

         if (relIx + expectedLen <= bufSize)
            return peekInputStr(expectedValue, negated, ignoreCase);

         eof = true;
         return negated ? 0 : 2;
      }
   }
/**
    * Warning: this method is tuned for performance so has a messy interface.  Using ArrString because we want to
    * use char arrays directly
    *
    * Look ahead into the currently parsed characters and match them against expectedValue.
    * If !negated:
    *    return 0 for a match and 1 for a non-match, 2 for EOF
    * If you pass in negated the match is opposite:
    *    return 1 for a match and 0 for a non-match, 0 for EOF
    */
this method is tuned for performance so has a messy interface.  Using ArrString because we want to
use char arrays directly

Look ahead into the currently parsed characters and match them against expectedValue.
If !negated:
return 0 for a match and 1 for a non-match, 2 for EOF
If you pass in negated the match is opposite:
return 1 for a match and 0 for a non-match, 0 for EOF
this method is tuned for performance so has a messy interface . Using ArrString because we want to use char arrays directly Look ahead into the currently parsed characters and match them against expectedValue . If !negated : return 0 for a match and 1 for a non - match 2 for EOF If you pass in negated the match is opposite : return 1 for a match and 0 for a non - match 0 for EOF
public int peekInputStr(ArrString expectedValue, boolean negated, boolean ignoreCase) {
      int relIx = currentIndex - currentBufferPos;
      if (relIx < 0)
         throw new IllegalArgumentException("Attempt to access character before the current buffer position");
      char[] expectedBuf = expectedValue.buf;
      int expectedLen = expectedBuf.length;
      if (relIx+expectedLen <= bufSize) {
         if (ignoreCase) {
            for (int i = 0; i < expectedLen; i++) {
               if (Character.toLowerCase(inputBuffer[relIx++]) != Character.toLowerCase(expectedBuf[i]))
                  return negated ? 0 : 1;
            }
         }
         else {
            for (int i = 0; i < expectedLen; i++) {
               if (inputBuffer[relIx++] != expectedBuf[i])
                  return negated ? 0 : 1;
            }
         }
         return !negated ? 0 : 1;
      }
      else {
         if (!eof) {
            while (relIx + expectedLen >= inputBuffer.length)
               growBuffer();
            fillBuffer();
         }
         if (relIx + expectedLen <= bufSize)
            return peekInputStr(expectedValue, negated, ignoreCase);
         eof = true;
         return negated ? 0 : 2;
      }
   }
public int peekInputStr ( ArrString expectedValue , boolean negated , boolean ignoreCase ) { int relIx = currentIndex - currentBufferPos ; if ( relIx < 0 ) throw new IllegalArgumentException ( "Attempt to access character before the current buffer position" ) ; char [ ] expectedBuf = expectedValue . buf ; int expectedLen = expectedBuf . length ; if ( relIx + expectedLen <= bufSize ) { if ( ignoreCase ) { for ( int i = 0 ; i < expectedLen ; i ++ ) { if ( Character . toLowerCase ( inputBuffer [ relIx ++ ] ) != Character . toLowerCase ( expectedBuf [ i ] ) ) return negated ? 0 : 1 ; } } else { for ( int i = 0 ; i < expectedLen ; i ++ ) { if ( inputBuffer [ relIx ++ ] != expectedBuf [ i ] ) return negated ? 0 : 1 ; } } return ! negated ? 0 : 1 ; } else { if ( ! eof ) { while ( relIx + expectedLen >= inputBuffer . length ) growBuffer ( ) ; fillBuffer ( ) ; } if ( relIx + expectedLen <= bufSize ) return peekInputStr ( expectedValue , negated , ignoreCase ) ; eof = true ; return negated ? 0 : 2 ; } }
Warning: this method is tuned for performance so has a messy interface.
Warning : this method is tuned for performance so has a messy interface .