Package com.alibaba.fastjson.parser

Examples of com.alibaba.fastjson.parser.JSONScanner.stringVal()


    public void test_string() throws Exception {
        {
            JSONScanner lexer = new JSONScanner("\'中国\'");
            lexer.config(Feature.AllowSingleQuotes, true);
            lexer.nextToken();
            Assert.assertEquals("中国", lexer.stringVal());
        }
        {
            JSONScanner lexer = new JSONScanner("'中国\t\\'\\\"'");
            lexer.config(Feature.AllowSingleQuotes, true);
            lexer.nextToken();
View Full Code Here


        }
        {
            JSONScanner lexer = new JSONScanner("'中国\t\\'\\\"'");
            lexer.config(Feature.AllowSingleQuotes, true);
            lexer.nextToken();
            Assert.assertEquals("中国\t'\"", lexer.stringVal());
        }
        {
            JSONScanner lexer = new JSONScanner("\'中国\tV5\'");
            lexer.config(Feature.AllowSingleQuotes, true);
            lexer.nextToken();
View Full Code Here

        }
        {
            JSONScanner lexer = new JSONScanner("\'中国\tV5\'");
            lexer.config(Feature.AllowSingleQuotes, true);
            lexer.nextToken();
            Assert.assertEquals("中国\tV5", lexer.stringVal());
        }

        StringBuilder buf = new StringBuilder();

        buf.append('\'');
View Full Code Here

        lexer.config(Feature.AllowSingleQuotes, true);
        lexer.nextToken();

        Assert.assertEquals(0, lexer.pos());

        String stringVal = lexer.stringVal();

        Assert.assertEquals("\"\\\\/\\b\\f\\n\\r\\t中\"", JSON.toJSONString(stringVal));

        JSON.toJSONString(stringVal);
    }
View Full Code Here

        lexer.config(Feature.AllowSingleQuotes, true);
        lexer.nextToken();

        Assert.assertEquals(0, lexer.pos());

        String stringVal = lexer.stringVal();

        // Assert.assertEquals("\"\\\\\\/\\b\\f\\n\\r\\t中\"",
        // JSON.toJSONString(stringVal));

        JSON.toJSONString(stringVal);
View Full Code Here

        lexer.config(Feature.AllowSingleQuotes, true);
        lexer.nextToken();

        Assert.assertEquals(0, lexer.pos());

        String stringVal = lexer.stringVal();

        // Assert.assertEquals("\"\\\\\\/\\b\\f\\n\\r\\t中\"",
        // JSON.toJSONString(stringVal));

        JSON.toJSONString(stringVal);
View Full Code Here

        lexer.config(Feature.AllowSingleQuotes, true);
        lexer.nextToken();

        Assert.assertEquals(0, lexer.pos());

        String stringVal = lexer.stringVal();

        // Assert.assertEquals("\"\\\\\\/\\b\\f\\n\\r\\t中\"",
        // JSON.toJSONString(stringVal));

        JSON.toJSONString(stringVal);
View Full Code Here

        JSONScanner lexer = new JSONScanner(text.toCharArray(), text.length());
        lexer.nextToken();

        Assert.assertEquals(0, lexer.pos());

        lexer.stringVal();

        // Assert.assertEquals("\"\\\\\\/\\b\\f\\n\\r\\t中\"",
        // JSON.toJSONString(stringVal));

    }
View Full Code Here

        if (lexer.token() == JSONToken.LITERAL_STRING && lexer.isRef()) {
          Object object = null;

          lexer.nextTokenWithColon(JSONToken.LITERAL_STRING);
          if (lexer.token() == JSONToken.LITERAL_STRING) {
            String ref = lexer.stringVal();
            if ("@".equals(ref)) {
              object = context.getObject();
            } else if ("..".equals(ref)) {
              ParseContext parentContext = context
                  .getParentContext();
View Full Code Here

          return object;
        }

        if (map.size() == 0 //
            && lexer.token() == JSONToken.LITERAL_STRING //
            && JSON.DEFAULT_TYPE_KEY.equals(lexer.stringVal())) {
          lexer.nextTokenWithColon(JSONToken.LITERAL_STRING);
          lexer.nextToken(JSONToken.COMMA);
          lexer.nextToken(keyDeserializer.getFastMatchToken());
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.