@Test public void testEnum() { StringBuilder sb = createDefTemplate(); sb.append("enum1 enum {A,B} default=A\n"); sb.append("enum2 enum {A, B} default=A\n"); sb.append("enum3 enum { A, B} default=A\n"); sb.append("enum4 enum { A, B } default=A\n"); sb.append("enum5 enum { A , B } default=A\n"); sb.append("enum6 enum {A , B } default=A\n"); sb.append("enumVal enum { FOO, BAR, FOOBAR }\n"); DefParser parser = createParser(sb.toString()); try { parser.getTree(); } catch (Exception e) { assertNotNull(null); } CNode root = parser.getTree(); LeafCNode node = (LeafCNode) root.getChild("enum1"); assertNotNull(node); assertThat(node.getDefaultValue().getStringRepresentation(), is("A")); }
public InnerCNode getTree() throws CodegenRuntimeException { try { if (root == null) parse(); } catch (DefParserException | IOException e) { throw new CodegenRuntimeException("Error parsing or reading config definition." + e.getMessage(), e); } return root; }
DefParser { public InnerCNode getTree() throws CodegenRuntimeException { try { if (root == null) parse(); } catch (DefParserException | IOException e) { throw new CodegenRuntimeException("Error parsing or reading config definition." + e.getMessage(), e); } return root; } }
DefParser { public InnerCNode getTree() throws CodegenRuntimeException { try { if (root == null) parse(); } catch (DefParserException | IOException e) { throw new CodegenRuntimeException("Error parsing or reading config definition." + e.getMessage(), e); } return root; } DefParser(String name, Reader defReader); }
DefParser { public InnerCNode getTree() throws CodegenRuntimeException { try { if (root == null) parse(); } catch (DefParserException | IOException e) { throw new CodegenRuntimeException("Error parsing or reading config definition." + e.getMessage(), e); } return root; } DefParser(String name, Reader defReader); InnerCNode getTree(); NormalizedDefinition getNormalizedDefinition(); static void dumpTree(CNode root, String indent); }
DefParser { public InnerCNode getTree() throws CodegenRuntimeException { try { if (root == null) parse(); } catch (DefParserException | IOException e) { throw new CodegenRuntimeException("Error parsing or reading config definition." + e.getMessage(), e); } return root; } DefParser(String name, Reader defReader); InnerCNode getTree(); NormalizedDefinition getNormalizedDefinition(); static void dumpTree(CNode root, String indent); static final String DEFAULT_PACKAGE_PREFIX; static final Pattern versionPattern; static final Pattern namespacePattern; static final Pattern packagePattern; }