Search in sources :

Example 11 with SymbolTable

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

the class JSONScannerTest_symbol method test_error.

public void test_error() throws Exception {
    JSONException error = null;
    try {
        SymbolTable symbolTable = new SymbolTable(512);
        JSONScanner lexer = new JSONScanner("\"nick \\a name\"");
        lexer.scanSymbol(symbolTable, '"');
        lexer.close();
    } catch (JSONException e) {
        error = e;
    }
    Assert.assertNotNull(error);
}
Also used : JSONScanner(com.alibaba.fastjson.parser.JSONScanner) JSONException(com.alibaba.fastjson.JSONException) SymbolTable(com.alibaba.fastjson.parser.SymbolTable)

Example 12 with SymbolTable

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

the class JSONScannerTest_symbol method test_6.

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

Example 13 with SymbolTable

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

the class JSONScannerTest_symbol method test_2.

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

Example 14 with SymbolTable

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

the class JSONScannerTest_symbol method test_5.

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

Example 15 with SymbolTable

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

the class JSONScannerTest_symbol method test_8.

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

Aggregations

SymbolTable (com.alibaba.fastjson.parser.SymbolTable)16 JSONScanner (com.alibaba.fastjson.parser.JSONScanner)15 JSONException (com.alibaba.fastjson.JSONException)2 CharsToNameCanonicalizer (com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer)1