void parse() { try { // http://jira.qos.ch/browse/LBCORE-130 // we escape ')' for parsing purposes. Note that the original pattern is preserved // because it is shown to the user in status messages. We don't want the escaped version // to leak out. String patternForParsing = escapeRightParantesis(pattern); Parser<Object> p = new Parser<Object>(patternForParsing, new AlmostAsIsEscapeUtil()); p.setContext(context); Node t = p.parse(); this.headTokenConverter = p.compile(t, CONVERTER_MAP); } catch (ScanException sce) { addError("Failed to parse pattern \"" + pattern + "\".", sce); } }
void parse() { try { Parser<Object> p = new Parser<Object>(pattern, new AlmostAsIsEscapeUtil()); p.setContext(context); Node t = p.parse(); this.headTokenConverter = p.compile(t, CONVERTER_MAP); } catch (ScanException sce) { addError("Failed to parse pattern \"" + pattern + "\".", sce); } }
void parse() { try { // http://jira.qos.ch/browse/LBCORE-130 // we escape ')' for parsing purposes. Note that the original pattern is preserved // because it is shown to the user in status messages. We don't want the escaped version // to leak out. String patternForParsing = escapeRightParantesis(pattern); Parser<Object> p = new Parser<Object>(patternForParsing, new AlmostAsIsEscapeUtil()); p.setContext(context); Node t = p.parse(); this.headTokenConverter = p.compile(t, CONVERTER_MAP); } catch (ScanException sce) { addError("Failed to parse pattern \"" + pattern + "\".", sce); } }
void parse() { try { // http://jira.qos.ch/browse/LOGBACK-197 // we escape ')' for parsing purposes. Note that the original pattern is preserved // because it is shown to the user in status messages. We don't want the escaped version // to leak out. String patternForParsing = escapeRightParantesis(pattern); Parser<Object> p = new Parser<Object>(patternForParsing, new AlmostAsIsEscapeUtil()); p.setContext(context); Node t = p.parse(); this.headTokenConverter = p.compile(t, CONVERTER_MAP); } catch (ScanException sce) { addError("Failed to parse pattern \"" + pattern + "\".", sce); } }
void parse() { try { // http://jira.qos.ch/browse/LOGBACK-197 // we escape ')' for parsing purposes. Note that the original pattern is preserved // because it is shown to the user in status messages. We don't want the escaped version // to leak out. String patternForParsing = escapeRightParantesis(pattern); Parser<Object> p = new Parser<Object>(patternForParsing, new AlmostAsIsEscapeUtil()); p.setContext(context); Node t = p.parse(); this.headTokenConverter = p.compile(t, CONVERTER_MAP); } catch (ScanException sce) { addError("Failed to parse pattern \"" + pattern + "\".", sce); } }
void parse() { try { // http://jira.qos.ch/browse/LBCORE-130 // we escape ')' for parsing purposes. Note that the original pattern is preserved // because it is shown to the user in status messages. We don't want the escaped version // to leak out. String patternForParsing = escapeRightParantesis(pattern); Parser<Object> p = new Parser<Object>(patternForParsing, new AlmostAsIsEscapeUtil()); p.setContext(context); Node t = p.parse(); this.headTokenConverter = p.compile(t, CONVERTER_MAP); } catch (ScanException sce) { addError("Failed to parse pattern \"" + pattern + "\".", sce); } }
void parse() { try { // http://jira.qos.ch/browse/LOGBACK-197 // we escape ')' for parsing purposes. Note that the original pattern is preserved // because it is shown to the user in status messages. We don't want the escaped version // to leak out. String patternForParsing = escapeRightParantesis(pattern); Parser<Object> p = new Parser<Object>(patternForParsing, new AlmostAsIsEscapeUtil()); p.setContext(context); Node t = p.parse(); this.headTokenConverter = p.compile(t, CONVERTER_MAP); } catch (ScanException sce) { addError("Failed to parse pattern \"" + pattern + "\".", sce); } }
void parse() { try { // http://jira.qos.ch/browse/LBCORE-130 // we escape ')' for parsing purposes. Note that the original pattern is preserved // because it is shown to the user in status messages. We don't want the escaped version // to leak out. String patternForParsing = escapeRightParantesis(pattern); Parser<Object> p = new Parser<Object>(patternForParsing, new AlmostAsIsEscapeUtil()); p.setContext(context); Node t = p.parse(); this.headTokenConverter = p.compile(t, CONVERTER_MAP); } catch (ScanException sce) { addError("Failed to parse pattern \"" + pattern + "\".", sce); } }
void parse() { try { // http://jira.qos.ch/browse/LOGBACK-197 // we escape ')' for parsing purposes. Note that the original pattern is preserved // because it is shown to the user in status messages. We don't want the escaped version // to leak out. String patternForParsing = escapeRightParantesis(pattern); Parser<Object> p = new Parser<Object>(patternForParsing, new AlmostAsIsEscapeUtil()); p.setContext(context); Node t = p.parse(); this.headTokenConverter = p.compile(t, CONVERTER_MAP); } catch (ScanException sce) { addError("Failed to parse pattern \"" + pattern + "\".", sce); } }
@Test public void testWindowsLikeBackSlashes() throws ScanException { List<Token> tl = new TokenStream("c:\\hello\\world.%i", new AlmostAsIsEscapeUtil()).tokenize(); List<Token> witness = new ArrayList<Token>(); witness.add(new Token(Token.LITERAL, "c:\\hello\\world.")); witness.add(Token.PERCENT_TOKEN); witness.add(new Token(Token.SIMPLE_KEYWORD, "i")); assertEquals(witness, tl); }
@Test public void compositedKeywordFollowedByOptions() throws ScanException { { List<Token> tl = new TokenStream("%d(A){o}", new AlmostAsIsEscapeUtil()).tokenize(); List<Token> witness = new ArrayList<Token>(); witness.add(Token.PERCENT_TOKEN); witness.add(new Token(Token.COMPOSITE_KEYWORD, "d")); witness.add(new Token(Token.LITERAL, "A")); witness.add(Token.RIGHT_PARENTHESIS_TOKEN); List<String> ol = new ArrayList<String>(); ol.add("o"); witness.add(new Token(Token.OPTION, ol)); assertEquals(witness, tl); } } }
@Test public void compositedKeyword() throws ScanException { { List<Token> tl = new TokenStream("%d(A)", new AlmostAsIsEscapeUtil()).tokenize(); List<Token> witness = new ArrayList<Token>(); witness.add(Token.PERCENT_TOKEN); witness.add(new Token(Token.COMPOSITE_KEYWORD, "d")); witness.add(new Token(Token.LITERAL, "A")); witness.add(Token.RIGHT_PARENTHESIS_TOKEN); assertEquals(witness, tl); } { List<Token> tl = new TokenStream("a %subst(%b C)", new AlmostAsIsEscapeUtil()).tokenize(); List<Token> witness = new ArrayList<Token>(); witness.add(new Token(Token.LITERAL, "a ")); witness.add(Token.PERCENT_TOKEN); witness.add(new Token(Token.COMPOSITE_KEYWORD, "subst")); witness.add(Token.PERCENT_TOKEN); witness.add(new Token(Token.SIMPLE_KEYWORD, "b")); witness.add(new Token(Token.LITERAL, " C")); witness.add(Token.RIGHT_PARENTHESIS_TOKEN); assertEquals(witness, tl); } }