Search in sources :

Example 91 with JSONScanner

use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.

the class JSONScannerTest_symbol method test_10.

public void test_10() throws Exception {
    SymbolTable symbolTable = new SymbolTable(512);
    JSONScanner lexer = new JSONScanner("\"nick \\t name\"");
    String symbol = lexer.scanSymbol(symbolTable, '"');
    Assert.assertTrue("nick \t name" == symbol);
    lexer.close();
}
Also used : JSONScanner(com.alibaba.fastjson.parser.JSONScanner) SymbolTable(com.alibaba.fastjson.parser.SymbolTable)

Example 92 with JSONScanner

use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.

the class JSONScannerTest_true method test_scan_true_11.

public void test_scan_true_11() throws Exception {
    JSONScanner lexer = new JSONScanner("true\ta");
    lexer.scanTrue();
}
Also used : JSONScanner(com.alibaba.fastjson.parser.JSONScanner)

Example 93 with JSONScanner

use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.

the class JSONScannerTest_true method test_scan_true_4.

public void test_scan_true_4() throws Exception {
    JSONException error = null;
    try {
        JSONScanner lexer = new JSONScanner("truz");
        lexer.scanTrue();
    } catch (JSONException e) {
        error = e;
    }
    Assert.assertNotNull(error);
}
Also used : JSONScanner(com.alibaba.fastjson.parser.JSONScanner) JSONException(com.alibaba.fastjson.JSONException)

Example 94 with JSONScanner

use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.

the class JSONScannerTest_true method test_scan_true_6.

public void test_scan_true_6() throws Exception {
    JSONException error = null;
    try {
        JSONScanner lexer = new JSONScanner("true\"");
        lexer.scanTrue();
    } catch (JSONException e) {
        error = e;
    }
    Assert.assertNotNull(error);
}
Also used : JSONScanner(com.alibaba.fastjson.parser.JSONScanner) JSONException(com.alibaba.fastjson.JSONException)

Example 95 with JSONScanner

use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.

the class JSONScannerTest_true method test_scan_true_7.

public void test_scan_true_7() throws Exception {
    JSONScanner lexer = new JSONScanner("true a");
    lexer.scanTrue();
}
Also used : JSONScanner(com.alibaba.fastjson.parser.JSONScanner)

Aggregations

JSONScanner (com.alibaba.fastjson.parser.JSONScanner)179 JSONException (com.alibaba.fastjson.JSONException)37 SymbolTable (com.alibaba.fastjson.parser.SymbolTable)15 JSONReader (com.alibaba.fastjson.JSONReader)11 ParseException (java.text.ParseException)5 BigInteger (java.math.BigInteger)3 DateFormat (java.text.DateFormat)3 SimpleDateFormat (java.text.SimpleDateFormat)3 Date (java.util.Date)3 JSONLexer (com.alibaba.fastjson.parser.JSONLexer)2 JSONObject (com.alibaba.fastjson.JSONObject)1 AccessibleObject (java.lang.reflect.AccessibleObject)1 BigDecimal (java.math.BigDecimal)1 AccessControlException (java.security.AccessControlException)1 Calendar (java.util.Calendar)1