Skip to content

Commit

Permalink
Don't throw error on interface
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw429s committed Apr 19, 2024
1 parent b2f36ba commit 900b3ce
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/main/antlr/BoxScriptGrammar.g4
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ interface:
RBRACE;

// TODO: default method implementations
interfaceFunction: functionSignature eos;
interfaceFunction: (preannotation)* functionSignature (
postannotation
)* eos;

// public String myFunction( String foo, String bar )
functionSignature:
Expand Down
4 changes: 3 additions & 1 deletion src/main/antlr/CFScriptGrammar.g4
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ interface:
javadoc? (preannotation)* INTERFACE postannotation* LBRACE interfaceFunction* RBRACE;

// TODO: default method implementations
interfaceFunction: functionSignature eos;
interfaceFunction: (preannotation)* functionSignature (
postannotation
)* eos;

// public String myFunction( String foo, String bar )
functionSignature:
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/ortus/boxlang/compiler/FeatureAudit.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,15 @@ public static void main( String[] args ) {
private static void scanFile( Path sourcePath, Map<String, List<FeatureAuditVisitor.FeatureUsed>> results,
Map<String, List<FeatureAuditVisitor.AggregateFeatureUsed>> aggregateResults, Boolean missing, Boolean aggregate, boolean doReport,
StringBuffer reportText, boolean quiet ) {
System.out.println( "Processing " + sourcePath.toString() );
ParsingResult result = new Parser().parse( sourcePath.toFile() );
System.out.println( "Processing: " + sourcePath.toString() );
ParsingResult result;
try {
result = new Parser().parse( sourcePath.toFile() );
} catch ( Throwable e ) {
System.out.println( "Parsing failed: " + e.getMessage() );
e.printStackTrace();
return;
}
if ( result.isCorrect() ) {
FeatureAuditVisitor visitor = new FeatureAuditVisitor();
result.getRoot().accept( visitor );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ protected BoxNode toAst( File file, BoxScriptGrammar.ClassOrInterfaceContext cla
if ( classOrInterface.boxClass() != null ) {
return toAst( file, classOrInterface.boxClass() );
} else if ( classOrInterface.interface_() != null ) {
throw new IllegalStateException( "interface Not implemented" );
issues.add( new Issue( "Interface not implemented", getPosition( classOrInterface.interface_() ) ) );
return new BoxNull( null, null );
// return toAst( file, classOrInterface.interface_() );
} else {
throw new IllegalStateException( "Unexpected classOrInterface type: " + classOrInterface.getText() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ private BoxNode toAst( File file, ClassOrInterfaceContext classOrInterface ) {
if ( classOrInterface.component() != null ) {
return toAst( file, classOrInterface.component() );
} else if ( classOrInterface.interface_() != null ) {
throw new IllegalStateException( "interface Not implemented" );
issues.add( new Issue( "Interface not implemented", getPosition( classOrInterface.interface_() ) ) );
return new BoxNull( null, null );
// return toAst( file, classOrInterface.interface_() );
} else {
throw new IllegalStateException( "Unexpected classOrInterface type: " + classOrInterface.getText() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ protected BoxNode toAst( File file, CFScriptGrammar.ClassOrInterfaceContext clas
if ( classOrInterface.boxClass() != null ) {
return toAst( file, classOrInterface.boxClass() );
} else if ( classOrInterface.interface_() != null ) {
throw new IllegalStateException( "interface Not implemented" );
issues.add( new Issue( "Interface not implemented", getPosition( classOrInterface.interface_() ) ) );
return new BoxNull( null, null );
// return toAst( file, classOrInterface.interface_() );
} else {
throw new IllegalStateException( "Unexpected classOrInterface type: " + classOrInterface.getText() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ private BoxNode toAst( File file, ClassOrInterfaceContext classOrInterface ) {
if ( classOrInterface.component() != null ) {
return toAst( file, classOrInterface.component() );
} else if ( classOrInterface.interface_() != null ) {
throw new IllegalStateException( "interface Not implemented" );
issues.add( new Issue( "Interface not implemented", getPosition( classOrInterface.interface_() ) ) );
return new BoxNull( null, null );
// return toAst( file, classOrInterface.interface_() );
} else {
throw new IllegalStateException( "Unexpected classOrInterface type: " + classOrInterface.getText() );
Expand Down

0 comments on commit 900b3ce

Please sign in to comment.