Package com.alibaba.fastjson.parser

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


            Assert.assertEquals(JSONToken.IDENTIFIER, lexer.token());
        }
        {
            JSONScanner lexer = new JSONScanner("nuul");
            lexer.nextToken();
            Assert.assertEquals(JSONToken.IDENTIFIER, lexer.token());
        }
        {
            JSONScanner lexer = new JSONScanner("nulk");
            lexer.nextToken();
            Assert.assertEquals(JSONToken.IDENTIFIER, lexer.token());
View Full Code Here


            Assert.assertEquals(JSONToken.IDENTIFIER, lexer.token());
        }
        {
            JSONScanner lexer = new JSONScanner("nulk");
            lexer.nextToken();
            Assert.assertEquals(JSONToken.IDENTIFIER, lexer.token());
        }
        {
            StringBuilder buf = new StringBuilder();
            buf.append('n');
            for (char ch = 'A'; ch <= 'Z'; ++ch) {
View Full Code Here

            for (char ch = 'a'; ch <= 'z'; ++ch) {
                buf.append(ch);
            }
            JSONScanner lexer = new JSONScanner(buf.toString());
            lexer.nextToken();
            Assert.assertEquals(JSONToken.IDENTIFIER, lexer.token());
        }
    }

    public void test_number() throws Exception {
        String text = "[0,1,-1,2E3,2E+3,2E-3,2e3,2e+3,2e-3]";
View Full Code Here

public class JSONScannerTest__nextToken extends TestCase {
    public void test_next() throws Exception {
        String text = "\"aaa\"";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextToken(JSONToken.LITERAL_INT);
        Assert.assertEquals(JSONToken.LITERAL_STRING, lexer.token());
    }
   
    public void test_next_1() throws Exception {
        String text = "[";
        JSONScanner lexer = new JSONScanner(text);
View Full Code Here

   
    public void test_next_1() throws Exception {
        String text = "[";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextToken(JSONToken.LITERAL_INT);
        Assert.assertEquals(JSONToken.LBRACKET, lexer.token());
    }
   
    public void test_next_2() throws Exception {
        String text = "{";
        JSONScanner lexer = new JSONScanner(text);
View Full Code Here

   
    public void test_next_2() throws Exception {
        String text = "{";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextToken(JSONToken.LITERAL_INT);
        Assert.assertEquals(JSONToken.LBRACE, lexer.token());
    }
   
    public void test_next_3() throws Exception {
        String text = "{";
        JSONScanner lexer = new JSONScanner(text);
View Full Code Here

   
    public void test_next_3() throws Exception {
        String text = "{";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextToken(JSONToken.LBRACKET);
        Assert.assertEquals(JSONToken.LBRACE, lexer.token());
    }
   
    public void test_next_4() throws Exception {
        String text = "";
        JSONScanner lexer = new JSONScanner(text);
View Full Code Here

   
    public void test_next_4() throws Exception {
        String text = "";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextToken(JSONToken.LBRACKET);
        Assert.assertEquals(JSONToken.EOF, lexer.token());
    }
   
    public void test_next_5() throws Exception {
        String text = " \n\r\t\f\b 1";
        JSONScanner lexer = new JSONScanner(text);
View Full Code Here

   
    public void test_next_5() throws Exception {
        String text = " \n\r\t\f\b 1";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextToken(JSONToken.LBRACKET);
        Assert.assertEquals(JSONToken.LITERAL_INT, lexer.token());
    }
   
    public void test_next_6() throws Exception {
        String text = "";
        JSONScanner lexer = new JSONScanner(text);
View Full Code Here

   
    public void test_next_6() throws Exception {
        String text = "";
        JSONScanner lexer = new JSONScanner(text);
        lexer.nextToken(JSONToken.EOF);
        Assert.assertEquals(JSONToken.EOF, lexer.token());
    }
   
    public void test_next_7() throws Exception {
        String text = "{";
        JSONScanner lexer = new JSONScanner(text);
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.