Skip to content

Commit

Permalink
Merge pull request #91 from ortus-boxlang/development
Browse files Browse the repository at this point in the history
v1.0.0-Beta9
  • Loading branch information
lmajano authored Aug 9, 2024
2 parents d8c6962 + d6b509e commit 49140b6
Show file tree
Hide file tree
Showing 170 changed files with 4,138 additions and 1,523 deletions.
239 changes: 130 additions & 109 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,111 +1,132 @@
{
// 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": "FeatureAudit",
"request": "launch",
"mainClass": "ortus.boxlang.compiler.FeatureAudit",
"projectName": "boxlang"
},
{
"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": "BoxLang Debugger",
"request": "launch",
"mainClass": "ortus.boxlang.debugger.DebugMain",
"projectName": "boxlang"
},
{
"type": "java",
"name": "Print AST",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "boxlang",
"args": [
"--printAST",
"-c",
"${input:boxlangScript}"
]
},
{
"type": "java",
"name": "BoxLang MiniServer",
"request": "launch",
"mainClass": "ortus.boxlang.web.MiniServer",
"projectName": "boxlang",
"args": [
"--debug",
"--webroot",
"workbench/www"
]
},
{
"type": "java",
"name": "BoxRunner",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "boxlang"
},
{
"type": "java",
"name": "CrazyFileTest",
"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 Task",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "boxlang",
"args": [
"src/test/bx/Task.bx"
]
},
{
"type": "java",
"name": "Run Module",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "boxlang",
"args": [
"test"
]
}
],
"inputs": [
{
"id": "boxlangScript",
"description": "Enter text to see the AST JSON",
"type": "promptString"
}
]
// 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": "FeatureAudit",
"request": "launch",
"mainClass": "ortus.boxlang.compiler.FeatureAudit",
"projectName": "boxlang"
},
{
"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": "BoxLang Debugger",
"request": "launch",
"mainClass": "ortus.boxlang.debugger.DebugMain",
"projectName": "boxlang"
},
{
"type": "java",
"name": "BoxRunner With Input",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "boxlang",
"args": [
"${input:actionCommand}",
"${input:arg1}"
]
},
{
"type": "java",
"name": "Print AST",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "boxlang",
"args": [
"--printAST",
"-c",
"${input:boxlangScript}"
]
},
{
"type": "java",
"name": "BoxLang MiniServer",
"request": "launch",
"mainClass": "ortus.boxlang.web.MiniServer",
"projectName": "boxlang",
"args": [
"--debug",
"--webroot",
"workbench/www"
]
},
{
"type": "java",
"name": "BoxRunner",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "boxlang"
},
{
"type": "java",
"name": "CrazyFileTest",
"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 Task",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "boxlang",
"args": [
"src/test/bx/Task.bx"
]
},
{
"type": "java",
"name": "Run Module",
"request": "launch",
"mainClass": "ortus.boxlang.runtime.BoxRunner",
"projectName": "boxlang",
"args": [
"test"
]
}
],
"inputs": [
{
"id": "boxlangScript",
"description": "Enter text to see the AST JSON",
"type": "promptString"
},
{
"id": "actionCommand",
"description": "Enter the action command",
"type": "promptString"
},
{
"id": "arg1",
"description": "Enter the action command arg1",
"type": "promptString"
}
]
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ dependencies {
testImplementation "com.google.truth:truth:1.+"
testImplementation "commons-cli:commons-cli:1.8.0"
// https://wiremock.org/
testImplementation "org.wiremock:wiremock:3.9.0"
testImplementation "org.wiremock:wiremock:3.9.1"
// https://mvnrepository.com/artifact/org.apache.derby/derby
testImplementation 'org.apache.derby:derby:10.17.1.0'
testImplementation 'io.undertow:undertow-core:2.3.15.Final'
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Fri Jul 26 19:21:16 UTC 2024
#Fri Aug 02 15:59:15 UTC 2024
antlrVersion=4.13.1
jdkVersion=21
version=1.0.0-beta8
version=1.0.0-beta9
6 changes: 3 additions & 3 deletions src/main/antlr/BoxTemplateGrammar.g4
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ expression: (EXPRESSION_PART | quotedString)+;

attribute:
// foo="bar" foo=bar
attributeName COMPONENT_EQUALS attributeValue
attributeName COMPONENT_EQUALS attributeValue?
// foo (value will default to empty string)
| attributeName;

Expand All @@ -51,12 +51,12 @@ attributeName: ATTRIBUTE_NAME;

// foo or.... "foo" or... 'foo' or... "#foo#" or... #foo#
attributeValue:
identifier
unquotedValue
| quotedString
| interpolatedExpression;

// foo
identifier: IDENTIFIER;
unquotedValue: UNQUOTED_VALUE_PART+;

// "text#expression#text" or ... 'text#expression#text'
quotedString:
Expand Down
58 changes: 56 additions & 2 deletions src/main/antlr/BoxTemplateLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,20 @@ options {
}
}
return count;
}

public boolean lastModeWas( int mode, int count ) {
java.util.List<Integer> modes = new java.util.ArrayList<Integer>();
modes.add( _mode );
for ( int m : _modeStack.toArray() ) {
modes.add( m );
}
if ( modes.size() - 1 < count ) {
return false;
}
return modes.get( modes.size() - count ) == mode;
}

}

/*
Expand Down Expand Up @@ -234,8 +247,6 @@ mode ATTVALUE;

COMPONENT_WHITESPACE_OUTPUT2: [ \t\r\n] -> skip;

IDENTIFIER: [a-z_$0-9-{}]+ -> popMode;

ICHAR20:
'#' -> type(ICHAR), pushMode(EXPRESSION_MODE_UNQUOTED_ATTVALUE);

Expand All @@ -244,6 +255,49 @@ OPEN_QUOTE: '"' -> pushMode(quotesModeCOMPONENT);
OPEN_SINGLE:
'\'' -> type( OPEN_QUOTE ), pushMode(squotesModeCOMPONENT);

// If we're in a cfoutput tag, don't pop as far and stay in outut mode
COMPONENT_CLOSE_OUTPUT2:
'>' {lastModeWas(OUTPUT_MODE,1)}? -> popMode, pushMode(DEFAULT_MODE), type(COMPONENT_CLOSE );

// If we're in a cfoutput tag, pop all the way out of the component
COMPONENT_SLASH_CLOSE2:
'/>' {lastModeWas(OUTPUT_MODE,1)}? -> popMode, popMode, popMode, type( COMPONENT_SLASH_CLOSE );

// There may be no value, so we need to pop out of ATTVALUE if we find the end of the component
COMPONENT_CLOSE5:
'>' -> popMode, popMode, popMode, popMode, type(COMPONENT_CLOSE);

COMPONENT_SLASH_CLOSE3:
'/>' -> popMode, popMode, popMode, popMode, type(COMPONENT_SLASH_CLOSE);

UNQUOTED_VALUE_PART: . -> pushMode(UNQUOTED_VALUE_MODE);

// *********************************************************************************************************************
mode UNQUOTED_VALUE_MODE;

// first whitespace pops all the way out of ATTVALUE back to component mode
COMPONENT_WHITESPACE_OUTPUT4:
[ \t\r\n] -> popMode, popMode, skip;

// If we're in a cfoutput tag, don't pop as far and stay in outut mode
COMPONENT_CLOSE_OUTPUT3:
'>' {lastModeWas(OUTPUT_MODE,2)}? -> popMode, popMode, pushMode(DEFAULT_MODE), type(
COMPONENT_CLOSE);

// If we find the end of the component, pop all the way out of the component
COMPONENT_CLOSE3:
'>' -> popMode, popMode, popMode, popMode, popMode, type(COMPONENT_CLOSE);

// If we're in a cfoutput tag, pop all the way out of the component
COMPONENT_SLASH_CLOSE5:
'/>' {lastModeWas(OUTPUT_MODE,1)}? -> popMode, popMode, popMode, popMode, type(
COMPONENT_SLASH_CLOSE );

COMPONENT_SLASH_CLOSE4:
'/>' -> popMode, popMode, popMode, popMode, popMode, type(COMPONENT_SLASH_CLOSE);

UNQUOTED_VALUE_PART2: . -> type(UNQUOTED_VALUE_PART);

// *********************************************************************************************************************
mode EXPRESSION_MODE_COMPONENT;

Expand Down
6 changes: 3 additions & 3 deletions src/main/antlr/CFTemplateGrammar.g4
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ expression: (EXPRESSION_PART | quotedString)+;

attribute:
// foo="bar" foo=bar
attributeName COMPONENT_EQUALS attributeValue
attributeName COMPONENT_EQUALS attributeValue?
// foo (value will default to empty string)
| attributeName;

Expand All @@ -60,12 +60,12 @@ attributeName: ATTRIBUTE_NAME;

// foo or.... "foo" or... 'foo' or... "#foo#" or... #foo#
attributeValue:
identifier
unquotedValue
| quotedString
| interpolatedExpression;

// foo
identifier: IDENTIFIER;
unquotedValue: UNQUOTED_VALUE_PART+;

// "text#expression#text" or ... 'text#expression#text'
quotedString:
Expand Down
Loading

0 comments on commit 49140b6

Please sign in to comment.