ParseCtxt { public final String readNameString() { int startPos = pos; if (!isDone() && isNameStartChar(currentChar())) { ++pos; while (!isDone() && isNameMiddleChar(currentChar())) ++pos; return text.substring(startPos, pos); } else { return null; } } ParseCtxt(String text);  ParseCtxt(String text, SyntaxVersion syntaxVersion); final boolean isDone(); static boolean isSpace(char ch); final ParseCtxt skipBlanks(); final boolean isOnChar(char ch); final char currentChar(); final void readChar(char ch); final boolean testAndReadChar(char ch); final char readCharAndAdvance(); String readCharsAndAdvanceUntil(char... charsToStopBefore); final String skipBlanksAndReadNameString(); final String readNameString(); boolean isNameStartChar(char ch); boolean isNameMiddleChar(char ch); void readString(String s); boolean readOptionalString(String s); boolean readOptionalChar(char ch); final String readTill(char ch); int getPos(); void setPos(int newPos); String getText(); SyntaxVersion getSyntaxVersion();  }
@Test public void testReadNameString() { assertEquals("hello", new ParseCtxt("hello").readNameString()); assertEquals("hEllo", new ParseCtxt("hEllo").readNameString()); assertEquals(null, new ParseCtxt(" hello").readNameString()); assertEquals("heLlo1_23", new ParseCtxt("heLlo1_23").readNameString()); assertEquals("heLlo1", new ParseCtxt("heLlo1=23").readNameString()); assertEquals(null, new ParseCtxt("11").readNameString()); assertEquals(null, new ParseCtxt("").readNameString()); assertEquals("_23x", new ParseCtxt("_23x").readNameString()); }