static Type matchKeyword()

in src/com/amazon/ion/impl/IonTokenReader.java [720:762]


    static Type matchKeyword(StringBuilder sb, int pos, int valuelen) throws IOException
    {
        Type keyword = null;

        switch (sb.charAt(pos++)) { // there has to be at least 1 chacter or we wouldn't be here
        case 'f':
            if (valuelen == 5 //    "f"
             && sb.charAt(pos++) == 'a'
             && sb.charAt(pos++) == 'l'
             && sb.charAt(pos++) == 's'
             && sb.charAt(pos++) == 'e'
            ) {
                keyword = Type.kwFalse;
            }
            break;
        case 'n':
            if (valuelen == 4 //    'n'
             && sb.charAt(pos++) == 'u'
             && sb.charAt(pos++) == 'l'
             && sb.charAt(pos++) == 'l'
            ) {
                keyword = Type.kwNull;
            }
            else if (valuelen == 3 //   'n'
                 && sb.charAt(pos++) == 'a'
                 && sb.charAt(pos++) == 'n'
            ) {
                keyword = Type.kwNan;
            }
            break;
        case 't':
            if (valuelen == 4 //    "t"
             && sb.charAt(pos++) == 'r'
             && sb.charAt(pos++) == 'u'
             && sb.charAt(pos++) == 'e'
            ) {
                keyword =  Type.kwTrue;
            }
            break;
        }

        return keyword;
    }