Ast
void debug() { try {
// Create an instance of swc4j.
Swc4j swc4j = new Swc4j();
// Prepare a TypeScript code snippet.
String code = "function add(a:number, b:number) { return a+b; }";
// Prepare a script name.
URL specifier = new URL("file:///storage/emulated/0/Apktool_M/abc.ts");
// Prepare an option with script name and media type.
Swc4jTranspileOptions options =
new Swc4jTranspileOptions()
.setSpecifier(specifier)
.setMediaType(Swc4jMediaType.TypeScript)
// Set capture tokens.
.setCaptureTokens(true)
.setParseMode(Swc4jParseMode.Script);
// Parse the code.
Swc4jParseOutput output = swc4j.parse(code, options);
// Print the tokens.
System.out.println("/*********************************************");
System.out.println(" The tokens are as follows.");
System.out.println("*********************************************/");
output.getTokens().forEach(it ->{
binding.editor.setText(it.getSpan().getLine()+ it.getSpan().getColumn());
});
} catch (Exception err) {
binding.editor.setText(err.getLocalizedMessage());
}
}
Hello, I took this Java code from your blog. I just have one question. Why are the lines and columns not printed in my EditText when the code has an error in the for loop?
Please leave a repo with the issue you mentioned.
Please leave a repo with the issue you mentioned.
This is my main problem, bro. When I want to analyze my JavaScript code, I want to get the line and column if I encounter an error and use it in my editor.
Please set a breakpoint and look inside. I don't understand why you want to add integer 'line' and integer 'column'.
Please set a breakpoint and look inside. I don't understand why you want to add integer 'line' and integer 'column'.
Because I am developing my own IDE, I want to know when my code has errors so that I can give the line and column to my code. For example, see the following link https://github.com/HanzoDev1375/Ghostide/blob/main/app/src/main/java/io/github/rosemoe/sora/langs/javascript/BasicSyntaxJavaScriptAnalyzer.java#L64 I don't like my code parser to be with antlr4. I am looking for a powerful parser. Please help me.
Did you really understand my question? it.getSpan().getLine()+ it.getSpan().getColumn() only gives you one integer.
Did you really understand my question?
it.getSpan().getLine()+ it.getSpan().getColumn()only gives you one integer.
Honey, that's for the token. Did you see my code?
I don't think you are showing enough respect.
I don't think you are showing enough respect.
I think you misunderstood what I meant. I need a feature to parse the code. If my code gives an error, I can display the error text and the line and column. like this error file in Main.js:1:40 So I need to get the line and column and apply it in my program so that a red wavy line is drawn under the word so that my user understands. We are now sending a sample image that works with the antlr4 parser.