Skip to content

Commit

Permalink
fixes for doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw429s committed Apr 10, 2024
1 parent f61a66b commit eff5868
Show file tree
Hide file tree
Showing 9 changed files with 234 additions and 156 deletions.
322 changes: 173 additions & 149 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,150 +1,174 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "BIFServiceProviderGenerator",
"request": "launch",
"mainClass": "tools.BIFServiceProviderGenerator",
"projectName": "boxlang"
},
{
"type": "java",
"name": "ComponentServiceProviderGenerator",
"request": "launch",
"mainClass": "tools.ComponentServiceProviderGenerator",
"projectName": "boxlang"
},
{
"type": "java",
"name": "BIFServiceProviderGenerator",
"request": "launch",
"mainClass": "TestCases.BIFServiceProviderGenerator",
"projectName": "boxlang"
},
{
"type": "java",
"name": "BoxLangDebugger",
"request": "launch",
"mainClass": "ortus.boxlang.debugger.BoxLangDebugger",
"projectName": "boxlang"
},
{
"type": "java",
"name": "Server",
"request": "launch",
"mainClass": "ortus.boxlang.web.Server",
"projectName": "boxlang"
},
{
"type": "java",
"name": "Phase1TryCatch",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase1TryCatch",
"projectName": "boxlang"
},
{
"type": "java",
"name": "Phase2Closure",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase2Closure",
"projectName": "boxlang"
},
{
"type": "java",
"name": "Phase2UDF",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase2UDF",
"projectName": "boxlang"
},
{
"type": "java",
"name": "BoxRunner",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "boxlang"
},
{
"type": "java",
"name": "ConfigLoader",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.config.ConfigLoader",
"projectName": "runtime"
},
{
"type": "java",
"name": "Phase2Lambda",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase2Lambda",
"projectName": "runtime"
},
{
"type": "java",
"name": "Phase2Closure",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase2Closure",
"projectName": "runtime"
},
{
"type": "java",
"name": "Phase2UDF",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase2UDF",
"projectName": "runtime"
},
{
"type": "java",
"name": "Phase1Switch",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase1Switch",
"projectName": "runtime"
},
{
"type": "java",
"name": "Phase1TryCatch",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase1TryCatch",
"projectName": "runtime"
},
{
"type": "java",
"name": "Phase1",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase1",
"projectName": "runtime",
"args": [
"--debug"
]
},
{
"type": "java",
"name": "debugger",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "boxlang",
"args": [
"--debugger",
"CrazyFileTest.cfs"
]
},
{
"type": "java",
"name": "Current File",
"request": "launch",
"mainClass": "${file}"
},
{
"type": "java",
"name": "BoxRunner Version",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "boxlang",
"args": [
"--version"
]
},
]
}
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "BXCompiler",
"request": "launch",
"mainClass": "ortus.boxlang.compiler.BXCompiler",
"projectName": "boxlang"
},
{
"type": "java",
"name": "CFTranspiler",
"request": "launch",
"mainClass": "ortus.boxlang.compiler.CFTranspiler",
"projectName": "boxlang"
},
{
"type": "java",
"name": "BIFServiceProviderGenerator",
"request": "launch",
"mainClass": "tools.BIFServiceProviderGenerator",
"projectName": "boxlang"
},
{
"type": "java",
"name": "ComponentServiceProviderGenerator",
"request": "launch",
"mainClass": "tools.ComponentServiceProviderGenerator",
"projectName": "boxlang"
},
{
"type": "java",
"name": "BIFServiceProviderGenerator",
"request": "launch",
"mainClass": "TestCases.BIFServiceProviderGenerator",
"projectName": "boxlang"
},
{
"type": "java",
"name": "BoxLangDebugger",
"request": "launch",
"mainClass": "ortus.boxlang.debugger.BoxLangDebugger",
"projectName": "boxlang"
},
{
"type": "java",
"name": "Server",
"request": "launch",
"mainClass": "ortus.boxlang.web.Server",
"projectName": "boxlang",
"args": [
"--webroot",
"src/main/java/ortus/boxlang/web/www2"
],
"_vmArgs": [
"-javaagent:C:\\BLFR\\fusionreactor.jar=name=BL,address=8088",
"-Dfrlicense=CLOUD-XIWW5-DMHWY-KKTZE-P6SOR-ZK9AN",
"-Dfradminpassword=password"
]
},
{
"type": "java",
"name": "Phase1TryCatch",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase1TryCatch",
"projectName": "boxlang"
},
{
"type": "java",
"name": "Phase2Closure",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase2Closure",
"projectName": "boxlang"
},
{
"type": "java",
"name": "Phase2UDF",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase2UDF",
"projectName": "boxlang"
},
{
"type": "java",
"name": "BoxRunner",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "boxlang"
},
{
"type": "java",
"name": "ConfigLoader",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.config.ConfigLoader",
"projectName": "runtime"
},
{
"type": "java",
"name": "Phase2Lambda",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase2Lambda",
"projectName": "runtime"
},
{
"type": "java",
"name": "Phase2Closure",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase2Closure",
"projectName": "runtime"
},
{
"type": "java",
"name": "Phase2UDF",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase2UDF",
"projectName": "runtime"
},
{
"type": "java",
"name": "Phase1Switch",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase1Switch",
"projectName": "runtime"
},
{
"type": "java",
"name": "Phase1TryCatch",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase1TryCatch",
"projectName": "runtime"
},
{
"type": "java",
"name": "Phase1",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.testing.Phase1",
"projectName": "runtime",
"args": [
"--debug"
]
},
{
"type": "java",
"name": "debugger",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "boxlang",
"args": [
"--debugger",
"CrazyFileTest.cfs"
]
},
{
"type": "java",
"name": "Current File",
"request": "launch",
"mainClass": "${file}"
},
{
"type": "java",
"name": "BoxRunner",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "runtime",
"args": [
"ortus.boxlang.runtime.testing.Phase1",
"--debug"
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@
*/
public abstract class AbstractTransformer implements Transformer {

protected Transpiler transpiler;
protected static JavaParser javaParser = new JavaParser(
protected Transpiler transpiler;
protected JavaParser javaParser = new JavaParser(
new ParserConfiguration().setLanguageLevel( ParserConfiguration.LanguageLevel.JAVA_17_PREVIEW ) );

/**
* Logger
*/
protected Logger logger;
protected Logger logger;

public AbstractTransformer( Transpiler transpiler ) {
this.transpiler = transpiler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ protected ParserRuleContext parserFirstStage( InputStream stream ) throws IOExce
}
}
token = lexer.nextToken();
docParser.setStartLine( token.getLine() );
docParser.setStartColumn( token.getCharPositionInLine() );
}

return parseTree;
Expand Down Expand Up @@ -1826,11 +1828,16 @@ private BoxStatement toAst( File file, CFScriptGrammar.FunctionContext node ) {
private BoxDocumentation getDocIndex( ParserRuleContext node ) {
int min = Integer.MAX_VALUE;
int index = -1;
for ( BoxNode doc : this.javadocs ) {

for ( BoxDocumentation doc : this.javadocs ) {
int distance = getPosition( node ).getStart().getLine() - doc.getPosition().getEnd().getLine();
if ( distance >= 0 && distance < min ) {
min = distance;
index = this.javadocs.indexOf( doc );
// We don't break here even if we find a matching one, because we want to find the clostest match. meaning there could be random doc comments
// orphaned above us, but we want the last one that is still before our node.
} else if ( distance < 0 ) {
break;
}
}
// remove element from the list and return it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static Boolean cast( Object object, Boolean fail ) {
return num.doubleValue() != 0;
}
if ( object instanceof String str ) {
Key aliasKey = Key.of( str );
Key aliasKey = Key.of( str.trim() );
if ( wkt.containsKey( aliasKey ) ) {
return wkt.getAsBoolean( aliasKey );
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/ortus/boxlang/runtime/types/Array.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,8 @@ public String asString() {
sb.append( "[\n " );
sb.append( wrapped.stream()
.map( value -> ( value instanceof IType t ? t.asString() : ( value == null ? "[null]" : value.toString() ) ) )
.collect( java.util.stream.Collectors.joining( ",\n " ) ) );
.map( line -> line.replaceAll( "(?m)^", " " ) ) // Add an indent to the start of each line
.collect( java.util.stream.Collectors.joining( ",\n" ) ) );
sb.append( "\n]" );
return sb.toString();
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/ortus/boxlang/runtime/types/Struct.java
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,8 @@ public String asString() {
sb.append( "{\n " );
sb.append( wrapped.entrySet().stream()
.map( entry -> entry.getKey().getName() + " : " + ( entry.getValue() instanceof IType t ? t.asString() : entry.getValue().toString() ) )
.collect( java.util.stream.Collectors.joining( ",\n " ) ) );
.map( line -> line.replaceAll( "(?m)^", " " ) ) // Add an indent to the start of each line
.collect( java.util.stream.Collectors.joining( ",\n" ) ) );
sb.append( "\n}" );
return sb.toString();
}
Expand Down
Loading

0 comments on commit eff5868

Please sign in to comment.