A powerful script interpreter for the EBS (Earl Bosch Script) language, featuring a rich JavaFX-based interactive development environment with syntax highlighting, autocomplete, and integrated database support.
- Custom Scripting Language: Full-featured scripting language with familiar syntax
- Type Casting: Explicit type conversions with
int(),string(),float(),double(),byte(),long(),boolean(),record(),map() - Bitmap Type: Define named bit fields within a byte (8-bit) for compact storage of flags and small values
- Intmap Type: Define named bit fields within an integer (32-bit) for storing larger bit-packed data structures
- typeof Operator: Get the type of any variable or expression at runtime (e.g.,
typeof areturns"string") - Screen Component Types: Type tracking for JavaFX screen components with
typeofreturning "Screen.Xxx" format and.javafxproperty for component introspection - Exception Handling: Robust error handling with
try-exceptions-whensyntax to catch specific or any errors - Interactive Console: JavaFX-based IDE with rich text editing
- Syntax Highlighting: Color-coded syntax for better readability
- Autocomplete: Intelligent code completion suggestions for keywords, built-ins, and JSON schemas
- Configurable Colors: Customize console colors via JSON configuration file
- Database Integration: Built-in SQL support with cursors and connections
- Type Aliases: Define reusable type aliases for complex types with the
typeofkeyword - Array Support: Multi-dimensional arrays with type safety
- JSON Support: Native JSON parsing with support for both standard quoted keys and JavaScript-style unquoted keys, validation, and schema support
- File I/O: Built-in file operations
- Extensible: Easy to add custom built-in functions
- Java 21 or higher
- Maven 3.x
- JavaFX 21
cd ScriptInterpreter mvn clean compilemvn javafx:runjava -cp target/classes com.eb.script.Run <script-file.ebs>You can customize the console colors by creating a console.cfg file in the root directory. The file uses JSON format to define color properties for different text styles.
Example console.cfg:
{"colors":{"info": "#e6e6e6", "error": "#ee0000", "warn": "#eeee00", "ok": "#00ee00", "keyword": "#00FFFF", "background": "#000000", "text": "#e6e6e6" } }See CONSOLE_CONFIG_GUIDE.md for complete configuration options and examples.
Best Practice for Screen Apps with Custom CSS:
When creating applications with screens and custom styling, organize your files in a dedicated directory:
my-screen-app/ ├── my-app.ebs # Main EBS script with screen definitions ├── custom-theme.css # Custom CSS for your screens └── README.md # Optional documentation This organization:
- Keeps related files together (easier to manage and deploy)
- Enables relative CSS paths from the EBS script location
- Simplifies version control and sharing
- Provides clear separation between different screen applications
Example:
// In my-screen-app/my-app.ebsscreenmyScreen={"title": "My App"};showscreenmyScreen;// Load CSS from same directory using relative pathcallcss.loadCss("myscreen","custom-theme.css");See ScriptInterpreter/scripts/examples/css-screen-demo/ for a complete working example.
// Variable declarationvarname: string="World";varcount: int=42;varitems: int[5];// Fixed-size arrayvardata: json={"key": "value"};// Standard JSON with quoted keysvarconfig: json={theme: "dark",volume: 80};// JavaScript-style unquoted keys (NEW)varsettings: map={"theme": "dark","volume": 80};// Map type// Control flowifcount>40then{print"Count is large";}// Loopswhilecount>0{printcount;count=count-1;}// Functionsgreet(name: string)returnstring{return"Hello, "+name+"!";}// Function callsvarmessage=callgreet("World");printmessage;// Arraysvarnumbers=[1,2,3,4,5];printnumbers[0];// Access elementsprintnumbers.length;// Get length// Array syntax comparison (see docs/ARRAY_SYNTAX_GUIDE.md for details):vartraditional: int[100];// Uses Object[] storage (boxed Integer)varenhanced: array.int[100];// Uses int[] storage (primitive, faster for large arrays)// Type aliases (typeof keyword)personTypetypeofrecord{name: string,age: int};varperson: personType;person={"name": "Alice","age": 30};// JSON syntaxprintperson;// Print the record// Record literal syntax (cleaner initialization)posTypetypeofrecord{x: int,y: int};varpos=posType{x: 10,y: 20};// No quotes on field namesprintpos.x;// Output: 10// Database operationsconnectdb="jdbc:oracle:thin:@localhost:1521:xe";usedb{cursormyCursor=select*fromuserswhereage>18;openmyCursor();whilecallmyCursor.hasNext(){varrow=callmyCursor.next();printrow.name;}closemyCursor;}closeconnectiondb;Note on JSON Syntax: The EBS JSON parser supports both standard JSON with quoted keys (
{"name": "value"}) and JavaScript-style unquoted keys ({name: "value"}). Both formats can be used interchangeably or mixed in the same document. Unquoted keys must be valid identifiers (letters, digits, underscore) and cannot start with a digit. Keys with special characters (hyphens, spaces, etc.) must be quoted.
The language supports explicit type casting for all data types. Use the format type(value) to cast values:
// String to number conversionsvarstrNum: string="42";varintVal: int=int(strNum);varfloatVal: float=float("3.14");varlongVal: long=long("999999999");// Number to string conversionsvarnumStr: string=string(123);// Between numeric typesvarwholeNum: int=int(3.14);// 3 (truncation)vardecimalNum: double=double(42);// 42.0// Boolean conversionsvarflag: bool=boolean("true");varflagStr: string=string(false);// Byte conversionsvarbyteVal: byte=byte(65);// Casting in expressionsvarstr1: string="10";varstr2: string="20";varsum: int=int(str1)+int(str2);// 30// Casting in conditionalsifint("15")>10then{print"Condition met";}Supported cast types:
int()orinteger()- Convert to integerlong()- Convert to long integerfloat()- Convert to floating pointdouble()- Convert to double precisionstring()- Convert to stringbyte()- Convert to byteboolean()orbool()- Convert to booleanrecord()- Cast JSON object to record with type inferencemap()- Cast JSON object to map (key-value store)
See scripts/test/test_type_casting.ebs for more examples.
The typeof operator returns the type of a variable or expression as a string:
// Simple typesvara: string="xyz";printtypeofa;// Output: stringvarnum: int=42;printtypeofnum;// Output: int// Record types - shows full structurevarb: record{x: string,y: int};b={"x": "hello","y": 42};printtypeofb;// Output: record{x:string, y:int}// Works with all typesvarflag: bool=true;printtypeofflag;// Output: bool// Can be used in conditionalsiftypeofa=="string"then{print"a is a string";}// Works with cast expressionsprinttypeofint("42");// Output: intSupported for all types:
- Primitive types:
string,int,long,float,double,bool,byte - Complex types:
array,json,map,date,record - For records, displays the complete structure with field names and types
See scripts/test/test_typeof_operator.ebs for more examples.
The language supports robust error handling with try-exceptions-when syntax. This allows you to catch specific types of errors or use ANY_ERROR to catch all errors:
// Basic exception handlingtry{varresult=10/0;// Will throw MATH_ERROR}exceptions{whenMATH_ERROR{print"Cannot divide by zero!";}whenANY_ERROR{print"An unexpected error occurred";}}// Capture error message in a variabletry{vardata= #file.read("missing.txt");}exceptions{whenIO_ERROR(msg){print"File error: "+msg;}}// Multiple specific handlerstry{// Some risky operationvarresult=processData();}exceptions{whenDB_ERROR{print"Database error occurred";}whenTYPE_ERROR{print"Type conversion failed";}whenANY_ERROR(errorMsg){print"Unexpected error: "+errorMsg;}}Available Error Types:
ANY_ERROR- Catches any error (catch-all handler, should typically be last)IO_ERROR- File I/O operations, streams, pathsDB_ERROR- Database connection and query errorsTYPE_ERROR- Type conversion and casting errorsNULL_ERROR- Null pointer or null value errorsINDEX_ERROR- Array index out of bounds errorsMATH_ERROR- Division by zero, arithmetic errorsPARSE_ERROR- JSON parsing, date parsing errorsNETWORK_ERROR- HTTP and network connection errorsNOT_FOUND_ERROR- Variable or function not found errorsACCESS_ERROR- Permission or access denied errorsVALIDATION_ERROR- Validation errors
Key Features:
- Error handlers are checked in order - the first matching handler is executed
- Use
when ERROR_TYPE(varName)to capture the error message in a variable - Multiple handlers can be specified for different error types
ANY_ERRORshould typically be placed last as it catches all errors- Try blocks can be nested for granular error handling
You can explicitly raise exceptions using the raise exception statement. This allows you to signal errors from your own code.
Standard Exceptions (from the ErrorType enum) only accept a single message parameter:
// Raise standard exceptions with a messageraiseexceptionIO_ERROR("File not found: config.txt");raiseexceptionVALIDATION_ERROR("Input must be a positive number");raiseexceptionMATH_ERROR("Cannot calculate square root of negative number");// Raise without a message (uses default message)raiseexceptionNULL_ERROR();Custom Exceptions can have multiple parameters and are identified by any name not in the standard ErrorType list:
// Raise custom exceptions with multiple parametersraiseexceptionValidationFailed("username","must be at least 3 characters");raiseexceptionOutOfBoundsError(10,0,5);// index, min, maxraiseexceptionBusinessRuleViolation("order",12345,"insufficient inventory");Catching Raised Exceptions:
// Catch standard exceptionstry{raiseexceptionVALIDATION_ERROR("Invalid input");}exceptions{whenVALIDATION_ERROR(msg){print"Validation failed: "+msg;}}// Catch custom exceptions by nametry{raiseexceptionMyCustomError("error details",42);}exceptions{whenMyCustomError(msg){print"Custom error: "+msg;}whenANY_ERROR(msg){print"Caught by ANY_ERROR: "+msg;}}Note: Both standard and custom exception names are matched case-insensitively. Any unrecognized exception type (not in the standard ErrorType list) is treated as a custom exception.
The map type provides a flexible key-value store where keys are strings and values can be any type. Maps are backed by JSON objects and are ideal for dynamic data storage.
// Declare a map variablevarconfig: map={"host": "localhost","port": 8080,"debug": true};// Cast JSON to mapvarjsonData: json={"name": "Alice","age": 30,"city": "NYC"};varuserMap=map(jsonData);// Access values using json functionsvarname=calljson.get(userMap,"name");// "Alice"varage=calljson.getint(userMap,"age");// 30// Modify and add valuescalljson.set(userMap,"city","Los Angeles");// Update existingcalljson.set(userMap,"country","USA");// Add new key// Nested mapsvarnested: json={"user": {"name": "Bob","settings": {"theme": "dark"}}};varnestedMap=map(nested);Map vs Record vs JSON:
| Type | Use Case |
|---|---|
map | Flexible key-value store, no schema required |
record | Type-safe access with predefined field names and types |
json | Any JSON structure including arrays, objects, and primitives |
See scripts/test/test_map_type.ebs for more examples.
The language provides comprehensive string manipulation functions. A useful function is str.charArray() which returns character codes:
// Get character codes from a stringvartext: string="Hello";varcodes=callstr.charArray(text);printcodes;// Output: [72, 101, 108, 108, 111]// Access individual character codesprintcodes[0];// Output: 72 (character 'H')printcodes[1];// Output: 101 (character 'e')// Use with string lengthprintcodes.length;// Output: 5// Check ASCII valuesvarletter: string="A";varletterCodes=callstr.charArray(letter);printletterCodes[0];// Output: 65 (ASCII code for 'A')Use cases for str.charArray():
- Character analysis and validation
- Custom encoding/decoding operations
- Character-by-character processing
- ASCII/Unicode value checking
- String transformation algorithms
See scripts/test/test_str_chararray.ebs for more examples.
Create interactive UI windows with thread-safe variables:
// Define a screen with variablesscreenmyWindow={"title": "My Application","width": 800,"height": 600,"vars": [{"name": "counter","type": "int","default": 0},{"name": "message","type": "string","default": "Hello"},{"name": "user","type": "record","default": {"name": "John","email": "[email protected]"}},{"name": "employees","type": "array.record","default": {"id": 0,"name": "","salary": 0.0}// Template for new records}]};// Access screen variables using screen_name.var_name syntaxvarcurrentCount=myWindow.counter;printcurrentCount;// Prints: 0// Assign to screen variablesmyWindow.counter=42;myWindow.message="Updated!";// Access record fieldsprintmyWindow.user.name;// Prints: JohnprintmyWindow.user.email;// Prints: john@example.com// Update record valuesmyWindow.user={"name": "Jane","email": "[email protected]"};// Array.record variables - default is a template for new recordsprintmyWindow.employees;// Initially empty: []// Assign array of recordsmyWindow.employees=[{"id": 1,"name": "Alice","salary": 75000},{"id": 2,"name": "Bob","salary": 65000}];// Access array elementsprintmyWindow.employees[0].name;// Prints: AliceprintmyWindow.employees.length;// Prints: 2// Show the screen (new syntax)showscreenmyWindow;// Hide the screen (new syntax)hidescreenmyWindow;// Show it againshowscreenmyWindow;Screen Features:
- Screens are created but NOT shown automatically - use
show screen <name>to display - Each screen runs in its own dedicated thread
- The thread automatically stops when the screen is closed
- All screen variables are thread-safe (using ConcurrentHashMap)
- Access variables via
screen_name.var_namesyntax (e.g.,myWindow.counter) - Assign to variables via
screen_name.var_name = value(e.g.,myWindow.counter = 10) - Variable assignments do not trigger screen display
- Multiple screens can be created and managed independently
- Supported Variable Types:
int,long,float,double,string,bool,byte,date,json,record, andarray.record- Record types allow storing structured data with multiple fields
- Access record fields:
screenName.varName.fieldName - Array.record types store arrays of records with a template for new entries
- Default value is a single record (template), not an array
- Variable initializes as empty array and can be populated with records
- Example:
"type": "array.record", "default":{"id": 0, "name": ""}
- Case-Insensitive JSON Keys: Screen definition JSON uses case-insensitive key lookup
- Property names like
varRef,VarRef, orvarrefare all treated identically - Keys are normalized to lowercase (
promptHelp→prompttext) - String values preserve their original casing
- Property names like
- Variable References in JSON: Use
$variable(without quotes) to reference script variables in JSON- Example:
"default": $myVarreferences the script variablemyVar - With quotes (
"$myVar"), it's treated as a literal string - See EBS_SCRIPT_SYNTAX.md for details
- Example:
You can use $variable references (without quotes) to create dynamic screens:
// Define script variablesvaruserName: string="Alice";varuserAge: int=30;varwindowTitle: string="User Profile";// Use $variable references in screen definition (no quotes)screenprofileScreen={"title": $windowTitle,// Dynamic title"width": 800,"height": 600,"vars": [{"name": "name","type": "string","default": $userName,// References userName variable"display": {"type": "textfield","labelText": "Name:"}},{"name": "age","type": "int","default": $userAge,// References userAge variable"display": {"type": "spinner","labelText": "Age:"}}]};showscreenprofileScreen;Important:
- Use
$variablewithout quotes to reference variables - With quotes (
"$variable"), it's a literal string, not a reference - Variables must exist in scope when the screen is defined
- Works with any data type (string, int, bool, arrays, JSON objects, etc.)
When using the interactive console:
/open <file>- Load a script from file/save <file>- Save the current script/help- Display help information/clear- Clear console output/echo on|off- Toggle statement echo mode/ai setup- Configure AI integration/safe-dirs- Configure trusted directories
Press Ctrl+Enter to execute the script in the editor. Press Ctrl+Space to trigger autocomplete for keywords, built-ins, and JSON properties.
The interactive console provides intelligent autocomplete support (triggered with Ctrl+Space):
- Keywords: Language keywords (
if,then,while,for,function,return, etc.) - Built-in Functions: Over 50 built-in functions like
print,substring,parseJson, etc. - Context-Aware: Shows only relevant suggestions based on context (e.g., built-ins after
callor#) - Console Commands: Autocomplete for
/commands when typing in console
When editing JSON content (screen definitions, area definitions, display metadata), autocomplete provides:
Property Names: Suggests valid property names from JSON schemas
- Type
{thenCtrl+Spaceto see all available properties - Start typing a property name for filtered suggestions (e.g., type
"nato seename)
- Type
Enum Values: Suggests valid enum values for properties with constrained values
- After
"type": ", pressCtrl+Spaceto see all valid control types (textfield, button, label, etc.) - After
"alignment": ", see valid alignment options (left, center, right, etc.)
- After
Example:
{"name": "LoginScreen", "type": " ← Ctrl+Space here shows: textfield, button, label, etc."title": ← Ctrl+Space after opening quote shows: property suggestions }Supported JSON Schemas:
screen-definition.json- Top-level screen properties (name, title, width, height, vars, area)area-definition.json- Container properties (type, layout, items, style)display-metadata.json- UI control metadata (type, mandatory, alignment, min, max, etc.)
The autocomplete automatically detects JSON content and provides schema-aware suggestions from all three schemas combined.
When working with EBS screens, you can toggle a debug panel by pressing Ctrl+D on any screen window. The debug panel appears on the right side and provides real-time information about the screen state:
The debug panel is divided into two sections with an adjustable divider:
Top Half: 📊 Variables
- Lists all screen variables with their names, types, and current values
- Variables are sorted alphabetically for easy lookup
- Hover over a variable name to see:
varName : dataType(e.g.,username : string) - Hover over a value to see the full content (useful for truncated strings, maps, lists, arrays)
Bottom Half: 🖼️ Screen Items
- Lists all screen area items from the screen definition
- Shows the item name with its actual current value from the JavaFX control
- Hover over an item name to see:
- Full qualified name:
screenName.itemName jfxType:- The JavaFX control type (TEXTFIELD, CHECKBOX, etc.)varRef:- The linked variable referencelayout:- The layout position
- Full qualified name:
Click the 📋 button in the panel header to copy all variables and screen items to clipboard. The format includes:
Screen: myScreen ================================================== 📊 VARIABLES ---------------------------------------- username : string = "john_doe" isActive : bool = true count : int = 42 🖼️ SCREEN ITEMS ---------------------------------------- myScreen.usernameField [TEXTFIELD] varRef: username = "john_doe" myScreen.activeCheck [CHECKBOX] varRef: isActive = true - Tooltips have a larger font (14px) for better readability
- Tooltips appear after 0.5 second delay to avoid interference with normal interaction
Press Ctrl+D again to hide the debug panel.
- EBS Script Syntax Reference - Complete language syntax guide including type aliases (typeof)
- EBS Collections Reference - Comprehensive guide to all collection types (arrays, queues, maps, JSON) with comparison tables and examples
- Array Syntax Guide - Comprehensive guide explaining differences between
int[n]andarray.int[n]syntax, including performance and memory usage comparisons - Python vs EBS String Functions - Comparison guide for Python developers learning EBS Script
- EBS Script vs Oracle PL/SQL - Comprehensive comparison guide for PL/SQL developers learning EBS Script
- Architecture & Flow Documentation - Comprehensive documentation of the system architecture, data flow, and internal workings
- Class Tree Lister - Utility for analyzing the project's class hierarchy
- Syntax Reference - EBNF grammar specification
maven-script-interpreter/ ├── ScriptInterpreter/ # Main project directory │ ├── src/ │ │ └── main/ │ │ ├── java/ │ │ │ └── com/eb/ │ │ │ ├── script/ # Core interpreter │ │ │ │ ├── token/ # Lexer and tokens │ │ │ │ ├── parser/ # Parser │ │ │ │ ├── interpreter/ # Interpreter and runtime │ │ │ │ ├── arrays/ # Array implementations │ │ │ │ ├── json/ # JSON support │ │ │ │ └── file/ # File I/O │ │ │ ├── ui/ # User interface │ │ │ │ ├── cli/ # Console components │ │ │ │ ├── ebs/ # Main application UI │ │ │ │ └── tabs/ # Tab management │ │ │ └── util/ # Utilities │ │ └── resources/ │ │ └── css/ # UI styling │ └── pom.xml # Maven configuration ├── ARCHITECTURE.md # Architecture documentation ├── README.md # This file └── CLASS_TREE_LISTER.md # Class hierarchy tool docs The interpreter follows a classic three-phase architecture:
- Lexical Analysis - Source code → Tokens (
EbsLexer) - Syntax Analysis - Tokens → Abstract Syntax Tree (
Parser) - Interpretation - AST → Execution (
Interpreter)
The UI layer provides an interactive console built with JavaFX, featuring:
- Rich text editing with syntax highlighting
- Command history and autocomplete
- Tab-based script management
- Real-time output display
For detailed architecture information, see ARCHITECTURE.md.
The interpreter includes numerous built-in functions:
toInt(),toFloat(),toDouble(),toString(),toBool()
substring(),length(),indexOf(),replace(),split()toUpperCase(),toLowerCase(),trim()string.contains(str, sub)- Checks if a string contains a substring, returns booleanstr.charArray()- Returns an array of integer character codes (Unicode code points) for each character in a string
push(),pop(),shift(),unshift()slice(),splice(),join()
abs(),min(),max(),round(),floor(),ceil()sqrt(),pow(),random()
readFile(),writeFile(),appendFile()fileExists(),deleteFile()
parseJson(),stringifyJson()validateJson(),deriveSchema()
Note: Screen definitions use case-insensitive JSON key parsing, where property names are normalized to lowercase. Regular JSON operations (parseJson()) preserve the original key casing.
now(),dateFormat(),parseDate()
css.getValue(cssPath, selector, property)- Retrieves a CSS property value from a stylesheet (e.g.,css.getValue("css/console.css", ".error", "-fx-fill")returns"#ee0000")css.findCss(searchPath?)- Searches for all available CSS stylesheet files and returns their paths as a string array
system.inputDialog(title, headerText?, defaultValue?)- Prompts user for text input, returns the entered stringsystem.confirmDialog(message, title?, headerText?)- Shows YES/NO confirmation dialog, returns booleansystem.alertDialog(message, title?, alertType?)- Shows message dialog with OK button (alertType: "info", "warning", "error")
The interpreter includes built-in database support with:
- Connection management
- SQL cursor operations
- Parameter binding
- Result set iteration
- Multiple simultaneous connections
Currently supports Oracle databases via OracleDbAdapter. Additional database adapters can be easily added by implementing the DbAdapter interface.
The interpreter includes built-in AI integration for calling language models. The AI module supports both synchronous and asynchronous operations.
Configure AI settings using the /ai setup console command, which prompts for:
- API endpoint URL
- API key
- Model name
// Simple AI completion (blocks until response)varresponse=callai.complete(systemPrompt,userPrompt,maxTokens,temperature);// ExamplevarsystemPrompt: string="You are a helpful assistant.";varuserPrompt: string="What is the capital of France?";varresult=callai.complete(systemPrompt,userPrompt,100,0.7);printresult;For non-blocking AI calls that keep the UI responsive:
// Async AI call returns a request IDvarrequestId: int=callai.completeAsync(systemPrompt,userPrompt,maxTokens,temperature,"callbackFunctionName");// The callback function receives a JSON responseonAiComplete(aiResponse: json){varisSuccess: bool=calljson.getBool(aiResponse,"success",false);varresult: string=calljson.getString(aiResponse,"result","");varwasCancelled: bool=calljson.getBool(aiResponse,"cancelled",false);ifisSuccessthen{print"AI Response: "+result;}elseifwasCancelledthen{print"Request was cancelled";}else{print"Error: "+result;}}Callback Response JSON Fields:
success(boolean) - Whether the AI call succeededresult(string) - The AI response text or error messagecancelled(boolean) - Whether the request was cancelled
Cancel pending AI requests using the request ID:
// Start an async requestvarrequestId: int=callai.completeAsync(system,user,200,0.7,"myCallback");// Cancel it if needed (e.g., user clicks Cancel button)callai.cancel(requestId);Cancellation Behavior:
- Cancellation is immediate on the client side
- The callback receives
{"success": false, "cancelled": true, "result": "Request was cancelled"} - The underlying HTTP request may continue in the background until it naturally completes
- From the user's perspective, cancellation is instant
| Function | Description |
|---|---|
ai.complete(system, user, maxTokens, temp) | Synchronous AI call, blocks until response |
ai.completeAsync(system, user, maxTokens, temp, callback) | Async AI call, returns request ID |
ai.cancel(requestId) | Cancels a pending async request |
Update UI controls programmatically (useful in AI callbacks):
// Disable a buttoncallscr.setProperty("screenName.buttonName","disabled",true);// Update text contentcallscr.setProperty("screenName.textAreaName","value","New text content");// Enable button after operationcallscr.setProperty("screenName.buttonName","disabled",false);Supported Properties:
disabled- Enable/disable controls (boolean)value/text- Update text content of TextField, TextArea, Label, or Button
Add new functions to the Builtins class:
publicstaticObjectmyFunction(Object[] args){// Implementationreturnresult}Register in the interpreter:
environment.declare("myFunction", newBuiltinInfo(...));Implement the DbAdapter interface:
publicclassMyDbAdapterimplementsDbAdapter{// Implement required methods }Set the adapter in the interpreter:
interpreter.setDbAdapter(newMyDbAdapter());You can add menu items that execute EBS scripts bundled as resources. This is useful for utility scripts like configuration editors.
Step 1: Add your script to resources
Place your .ebs script in ScriptInterpreter/src/main/resources/scripts/:
src/main/resources/ └── scripts/ └── my_script.ebs Step 2: Add a menu item in EbsMenu.java
MenuItemmyScriptItem = newMenuItem("My Script…"); myScriptItem.setOnAction(e ->{handler.runScriptFromResource("/scripts/my_script.ebs", "My Script")}); // Add to the appropriate menutoolsMenu.getItems().add(myScriptItem);The runScriptFromResource method:
- Loads the script from the classpath resources
- Executes it in a background thread (doesn't block the UI)
- Updates the status bar during execution
- Displays errors in the console output if execution fails
Parameters:
resourcePath- Path to the script resource (e.g.,/scripts/my_script.ebs)scriptName- Friendly name shown in status bar and error messages
Example: Color Editor Menu Item
MenuItemcolorsItem = newMenuItem("Colors…"); colorsItem.setOnAction(e ->{handler.runScriptFromResource("/scripts/color_editor.ebs", "Color Editor")});Contributions are welcome! Areas for enhancement:
- Additional database adapters
- More built-in functions
- Enhanced error messages
- Performance optimizations
- Testing infrastructure
- Additional language features
[Specify license here]
Earl Bosch
- JavaFX for the UI framework
- RichTextFX for advanced text editing capabilities