README.md
02 - Quoted Values and Tokenization
This example explores how the Intuitive DSL Lexer handles spaces, punctuation, and multi-word strings.
Understanding when to use single quotes ('...') is crucial for designing and parsing resilient commands.
What is covered
- Single Words: Alphanumeric strings without spaces do not require quotes (e.g., admin, john).
- Multi-word Strings: Sentences or strings containing spaces must be enclosed in single quotes (e.g., 'john doe', 'Meeting Notes').
- Punctuation: The engine's lexer treats punctuation marks (like ., ,, :) as separate structural tokens (DELIMITER). Therefore, strings containing punctuation must be quoted (e.g., 'super.admin', 'v1.0.0').
- Escaping: Single quotes inside a quoted string must be escaped with a backslash (e.g., 'It\'s working').
Running the Example
From your IDE
Execute the main method in TokenizationApp.java. Notice how the last scenario intentionally fails and catches a DslSyntaxException to demonstrate what happens when quotes are omitted.
From the command line
Navigate to this directory (02-quoted-values-and-tokenization) and run:
mvn clean compile exec:java