Live Data progress
This commit is contained in:
parent
5c40e59d81
commit
e5427b8e65
|
@ -20,6 +20,9 @@ import java.util.Stack;
|
|||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
|
||||
/**
|
||||
* see PrintCPP14ParserListener
|
||||
*/
|
||||
public class CodeWalkthrough {
|
||||
private static final Logging log = getLogging(CodeWalkthrough.class);
|
||||
// active statements - light green
|
||||
|
@ -43,11 +46,14 @@ public class CodeWalkthrough {
|
|||
|
||||
java.util.List<TerminalNode> allTerminals = new java.util.ArrayList<>();
|
||||
|
||||
java.util.List<CPP14Parser.DeclaratorContext> functions = new ArrayList<>();
|
||||
|
||||
new ParseTreeWalker().walk(new CPP14ParserBaseListener() {
|
||||
@Override
|
||||
public void enterFunctionDefinition(CPP14Parser.FunctionDefinitionContext ctx) {
|
||||
// new method is starting new all over
|
||||
resetState(currentState);
|
||||
functions.add(ctx.declarator());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.awt.event.ActionListener;
|
|||
/**
|
||||
* Andrey Belomutskiy, (c) 2013-2020
|
||||
* @see LiveDataParserPanel
|
||||
* See LiveDataPaneSandbox
|
||||
*/
|
||||
public class LiveDataPane {
|
||||
public static final String CPP_SUFFIX = ".cpp";
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.rusefi.ui;
|
||||
|
||||
import com.rusefi.ui.util.FrameHelper;
|
||||
|
||||
public class LiveDataPaneSandbox {
|
||||
public static void main(String[] args) {
|
||||
UIContext uiContext = new UIContext();
|
||||
new FrameHelper().showFrame(new LiveDataPane(uiContext).getContent());
|
||||
}
|
||||
}
|
|
@ -84,11 +84,15 @@ public class LiveDataParserTest {
|
|||
SourceCodePainter painter = mock(SourceCodePainter.class);
|
||||
ParseTree tree = LiveDataParserPanel.getParseTree(sourceCode);
|
||||
|
||||
printTree(tree);
|
||||
CodeWalkthrough.applyVariables(valueSource, sourceCode, painter, tree);
|
||||
return painter;
|
||||
}
|
||||
|
||||
private static void printTree(ParseTree tree) {
|
||||
System.out.println("******************************************* Just print everything for educational purposes");
|
||||
new ParseTreeWalker().walk(new PrintCPP14ParserListener(), tree);
|
||||
System.out.println("******************************************* Now running FOR REAL");
|
||||
CodeWalkthrough.applyVariables(valueSource, sourceCode, painter, tree);
|
||||
return painter;
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -98,6 +102,7 @@ public class LiveDataParserTest {
|
|||
assertTrue(sourceCode.length() > 100);
|
||||
|
||||
ParseTree tree = LiveDataParserPanel.getParseTree(sourceCode);
|
||||
LiveDataParserTest.printTree(tree);
|
||||
ParseResult parseResult = CodeWalkthrough.applyVariables(VariableValueSource.VOID, sourceCode, SourceCodePainter.VOID, tree);
|
||||
assertFalse(parseResult.getConfigTokens().isEmpty());
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue