Skip to content

Feat java21 p4 lsp dap - #2

Merged
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap
Mar 6, 2026
Merged

Feat java21 p4 lsp dap#2
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap

Conversation

@opaopa6969

Copy link
Copy Markdown
Owner

No description provided.

opaopa6969and others added 26 commits February 27, 2026 11:45
## Main project (tinyexpression)
- ExecutionBackend: add P4_AST_EVALUATOR and P4_DSL_JAVA_CODE enum entries
with fromRuntimeMode() aliases (p4-ast, p4-dsl-javacode)
- P4AstEvaluatorCalculator: type-safe P4 parser probe with fallback to
AstEvaluatorCalculator; records _tinyP4ParserUsed / _tinyP4AstNodeType
- P4DslJavaCodeCalculator: P4-parser override for DslJavaCodeCalculator
- CalculatorCreatorRegistry: register p4AstEvaluatorCreator() and
p4DslJavaCodeCreator(); add forBackend() switch entry
- TinyExpressionDapRuntimeBridge: copy _tinyP4ParserUsed and
_tinyP4AstNodeType markers in parity probe (6 backends)
- CommaParser: remove invalid @OverRide on expectedDisplayText()
(method not in SingleCharacterParser 2.4.0)
- Test compat fixes for unlaxer-common 2.4.0:
ParserTestBase (getTokenString→source), StringContentsTest,
TokenTest (int→CodePointIndex)
- P4BackendParityTest: 7 parity tests; all PASS
## Tools (tinyexpression-p4-lsp-vscode)
- UBNF grammar: tinyexpression-p4.ubnf
- pom.xml: generators=Parser,AST,Mapper,Evaluator,LSP,Launcher,DAP,DAPLauncher
- TinyExpressionP4LanguageServerExt: type-safe semantic tokens via
instanceof (no regex), ParseFailureDiagnostics sealed interface,
TE001 enriched diagnostics, keyword/variable completion
- TinyExpressionP4DebugAdapterExt: captures formula/runtimeMode in
launch(); adds _tinyP4ParserUsed / _tinyP4AstNodeType / _tinyP4AstNodePath
to DAP variables panel using sealed interface switch
- extension.ts: LSP via -jar, DAP via -cp with DapLauncherExt main class
- .gitignore + .vscodeignore: exclude node_modules/out/target/vsix
- server-dist/tinyexpression-p4-lsp-server.jar: fat jar (3.7 MB)
## Docs
- TINYEXPRESSION-P4-LSP-DAP-IMPL-PLAN.md: implementation plan
- TINYEXPRESSION-P4-LSP-DAP-TASKS.md: task tracker (89% complete)
- TINYEXPRESSION-P4-PIPELINE-GUIDE.md: beginner's guide to
UBNF→ParseTree→AST→Evaluator→LSP/DAP pipeline
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…LICENSE
- Remove `files` field from package.json (conflicts with .vscodeignore in vsce)
- Recreate .vscodeignore excluding node_modules, target, src, grammar, pom.xml
- Add README.md with features, quick-start, settings table, supported file patterns, architecture
- Add LICENSE (MIT) copied from calculator-lsp-vscode
- Add missing package.json fields: repository, homepage, bugs, author, publisher, activationEvents,
commands contribution, filenames/filenamePatterns for default/emergency files,
semanticTokenScopes, tinyExpressionP4Lsp.fileExtensions setting, package script
- VSIX now includes LICENSE automatically and builds cleanly at ~3.3 MB
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gging
Extension (TypeScript):
- Add `showServerOutput` command handler: calls outputChannel.show() so users can
inspect server logs and diagnose Java startup issues
- Add startup logging: logs java path, jar path and JVM args to output channel on activate()
- Add startup error notification: shows VS Code error message if client.start() rejects
Java LSP server:
- Add `codeActionProvider: true` to ServerCapabilities (initialize response)
- Implement `codeAction()` in ExtTextDocumentService:
- TE001 + starts with 'if': offer "Rewrite 'if' to P4 syntax" quick fix
- TE001 + bare funcName(): offer "Add 'call' keyword" quick fix
- TE001 (any): offer P4 syntax reference hint action
Version: 0.1.0 → 0.1.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause: vscode-languageclient and its transitive deps were not included
in the VSIX, causing `require('vscode-languageclient/node')` to fail at
load time → extension silently failed → no diagnostics, no command handler.
Fix:
- Switch `vscode:prepublish` from `tsc` to `esbuild --bundle`
- esbuild inlines vscode-languageclient + all transitive deps into out/extension.js
- Only `vscode` is kept external (provided by VS Code host)
- .vscodeignore: remove node_modules exception (no longer needed)
- Move showServerOutput registerCommand before LanguageClient setup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Problem: files with metadata headers (tags:, description:, etc.) were
causing TE001 errors on every line because the P4 parser was trying to
parse the full file content including the metadata section.
Fix:
- Add extractFormulaSection(): scans for 'formula:' line, extracts
formula content and its line-number offset within the document
- parseDocument() now routes to parseWithFormulaSection() when the
'formula:' marker is found, passing only the formula text to the parser
- publishEnrichedDiagnostics() accepts lineOffset: shifts diagnostic
range positions so they point into the correct lines in the full document
- computeSemanticTokens() accepts lineOffset: adds offset to token lines
so semantic highlighting lands on the formula section, not line 0
- ExtDocumentState gains lineOffset field
- Plain .tinyexp files (no 'formula:' marker) continue to work as before
- Windows \r\n line endings handled via .replace('\r', '') before comparison
Test:
tags:NORMAL / formula: / 1+2 / ---END_OF_PART--- → no diagnostics
tags:NORMAL / formula: / if @@@broken / --- → TE001 at line 3 ✓
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Motivation: real-world files mix non-formula content (metadata headers,
Markdown, etc.) with TinyExpression formulas. Rather than implementing a
full host-language parser, a lightweight DocumentFilter wrapper can strip
the non-formula parts so the P4 parser sees only valid input.
New files:
- FormulaSection.java — record(content, lineOffset): the extracted slice
- DocumentFilter.java — @FunctionalInterface with built-in implementations:
passThrough() — parse whole document (plain .tinyexp)
formulaInfo() — FormulaInfo 'formula:' / '---END_OF_PART---' format
fenced(open,close)— generic fence markers (e.g. "```tinyexp" / "```")
autoDetect() — formulaInfo() with null fallback (default)
firstMatch(...) — try multiple filters in order
Changes to TinyExpressionP4LanguageServerExt:
- Add DocumentFilter field + two constructors (default: autoDetect())
- parseDocument() delegates to documentFilter.extract() instead of
calling extractFormulaSection() directly
- Remove inline 'record FormulaSection' (now a top-level class)
Usage example (custom Launcher for Markdown files):
new TinyExpressionP4LanguageServerExt(
DocumentFilter.fenced("```tinyexp", "```"))
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends DocumentFilter with a new legacy() strategy that preprocesses
documents containing constructs not in the P4 grammar, enabling them to
validate without errors:
- Fenced code blocks (```java:Foo ... ```) replaced with blank lines
- Import declarations (import ...;) replaced with blank lines
- External invocations (external returning as TYPE name(args)) rewritten
to call name(args) with space-padding to preserve character positions
autoDetect() now composes formulaInfo() + legacy() via firstMatch(), so
FormulaInfo files, legacy pre-P4 files, and plain P4 files are all handled
by the default filter without any server configuration.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds grammar-native support for pre-P4 constructs so they are properly
validated rather than silently masked:
- ImportDeclaration: import ClassName#method as alias;
Validates FQCN, '#' separator, 'as' alias syntax
- ExternalBooleanInvocation / ExternalNumberInvocation /
ExternalStringInvocation / ExternalObjectInvocation:
external returning as <type> funcName(args)
Validates return type keyword, method name, argument syntax
Formula root rule updated: { ImportDeclaration } precedes VariableDeclaration.
DocumentFilter.legacy() now only masks fenced Java blocks (```java:... ```)
since import and external are grammar-defined. Regular lines pass through
unchanged and are validated by the P4 parser.
Keywords 'import', 'external', 'returning' added to KEYWORD_SET and
COMPLETION_KEYWORDS for semantic highlighting and completion.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Generate 106 SVG railroad diagrams from complete UBNF grammar
- Create GitHub-compatible README.md with complete rule documentation
- Update grammar documentation to link to new railroad diagrams
- All diagrams are SVG and viewable directly in GitHub markdown
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add 'References:' section to each rule diagram
- References are markdown links to related NonTerminal rules
- Enables single-page navigation within README.md on GitHub
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@opaopa6969
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Feat java21 p4 lsp dap by opaopa6969 · Pull Request #2 · opaopa6969/tinyexpression · GitHub
Skip to content

Feat java21 p4 lsp dap - #2

Merged
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap
Mar 6, 2026
Merged

Feat java21 p4 lsp dap#2
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap

Conversation

@opaopa6969

Copy link
Copy Markdown
Owner

No description provided.

opaopa6969and others added 26 commits February 27, 2026 11:45
## Main project (tinyexpression)
- ExecutionBackend: add P4_AST_EVALUATOR and P4_DSL_JAVA_CODE enum entries
with fromRuntimeMode() aliases (p4-ast, p4-dsl-javacode)
- P4AstEvaluatorCalculator: type-safe P4 parser probe with fallback to
AstEvaluatorCalculator; records _tinyP4ParserUsed / _tinyP4AstNodeType
- P4DslJavaCodeCalculator: P4-parser override for DslJavaCodeCalculator
- CalculatorCreatorRegistry: register p4AstEvaluatorCreator() and
p4DslJavaCodeCreator(); add forBackend() switch entry
- TinyExpressionDapRuntimeBridge: copy _tinyP4ParserUsed and
_tinyP4AstNodeType markers in parity probe (6 backends)
- CommaParser: remove invalid @OverRide on expectedDisplayText()
(method not in SingleCharacterParser 2.4.0)
- Test compat fixes for unlaxer-common 2.4.0:
ParserTestBase (getTokenString→source), StringContentsTest,
TokenTest (int→CodePointIndex)
- P4BackendParityTest: 7 parity tests; all PASS
## Tools (tinyexpression-p4-lsp-vscode)
- UBNF grammar: tinyexpression-p4.ubnf
- pom.xml: generators=Parser,AST,Mapper,Evaluator,LSP,Launcher,DAP,DAPLauncher
- TinyExpressionP4LanguageServerExt: type-safe semantic tokens via
instanceof (no regex), ParseFailureDiagnostics sealed interface,
TE001 enriched diagnostics, keyword/variable completion
- TinyExpressionP4DebugAdapterExt: captures formula/runtimeMode in
launch(); adds _tinyP4ParserUsed / _tinyP4AstNodeType / _tinyP4AstNodePath
to DAP variables panel using sealed interface switch
- extension.ts: LSP via -jar, DAP via -cp with DapLauncherExt main class
- .gitignore + .vscodeignore: exclude node_modules/out/target/vsix
- server-dist/tinyexpression-p4-lsp-server.jar: fat jar (3.7 MB)
## Docs
- TINYEXPRESSION-P4-LSP-DAP-IMPL-PLAN.md: implementation plan
- TINYEXPRESSION-P4-LSP-DAP-TASKS.md: task tracker (89% complete)
- TINYEXPRESSION-P4-PIPELINE-GUIDE.md: beginner's guide to
UBNF→ParseTree→AST→Evaluator→LSP/DAP pipeline
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…LICENSE
- Remove `files` field from package.json (conflicts with .vscodeignore in vsce)
- Recreate .vscodeignore excluding node_modules, target, src, grammar, pom.xml
- Add README.md with features, quick-start, settings table, supported file patterns, architecture
- Add LICENSE (MIT) copied from calculator-lsp-vscode
- Add missing package.json fields: repository, homepage, bugs, author, publisher, activationEvents,
commands contribution, filenames/filenamePatterns for default/emergency files,
semanticTokenScopes, tinyExpressionP4Lsp.fileExtensions setting, package script
- VSIX now includes LICENSE automatically and builds cleanly at ~3.3 MB
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gging
Extension (TypeScript):
- Add `showServerOutput` command handler: calls outputChannel.show() so users can
inspect server logs and diagnose Java startup issues
- Add startup logging: logs java path, jar path and JVM args to output channel on activate()
- Add startup error notification: shows VS Code error message if client.start() rejects
Java LSP server:
- Add `codeActionProvider: true` to ServerCapabilities (initialize response)
- Implement `codeAction()` in ExtTextDocumentService:
- TE001 + starts with 'if': offer "Rewrite 'if' to P4 syntax" quick fix
- TE001 + bare funcName(): offer "Add 'call' keyword" quick fix
- TE001 (any): offer P4 syntax reference hint action
Version: 0.1.0 → 0.1.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause: vscode-languageclient and its transitive deps were not included
in the VSIX, causing `require('vscode-languageclient/node')` to fail at
load time → extension silently failed → no diagnostics, no command handler.
Fix:
- Switch `vscode:prepublish` from `tsc` to `esbuild --bundle`
- esbuild inlines vscode-languageclient + all transitive deps into out/extension.js
- Only `vscode` is kept external (provided by VS Code host)
- .vscodeignore: remove node_modules exception (no longer needed)
- Move showServerOutput registerCommand before LanguageClient setup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Problem: files with metadata headers (tags:, description:, etc.) were
causing TE001 errors on every line because the P4 parser was trying to
parse the full file content including the metadata section.
Fix:
- Add extractFormulaSection(): scans for 'formula:' line, extracts
formula content and its line-number offset within the document
- parseDocument() now routes to parseWithFormulaSection() when the
'formula:' marker is found, passing only the formula text to the parser
- publishEnrichedDiagnostics() accepts lineOffset: shifts diagnostic
range positions so they point into the correct lines in the full document
- computeSemanticTokens() accepts lineOffset: adds offset to token lines
so semantic highlighting lands on the formula section, not line 0
- ExtDocumentState gains lineOffset field
- Plain .tinyexp files (no 'formula:' marker) continue to work as before
- Windows \r\n line endings handled via .replace('\r', '') before comparison
Test:
tags:NORMAL / formula: / 1+2 / ---END_OF_PART--- → no diagnostics
tags:NORMAL / formula: / if @@@broken / --- → TE001 at line 3 ✓
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Motivation: real-world files mix non-formula content (metadata headers,
Markdown, etc.) with TinyExpression formulas. Rather than implementing a
full host-language parser, a lightweight DocumentFilter wrapper can strip
the non-formula parts so the P4 parser sees only valid input.
New files:
- FormulaSection.java — record(content, lineOffset): the extracted slice
- DocumentFilter.java — @FunctionalInterface with built-in implementations:
passThrough() — parse whole document (plain .tinyexp)
formulaInfo() — FormulaInfo 'formula:' / '---END_OF_PART---' format
fenced(open,close)— generic fence markers (e.g. "```tinyexp" / "```")
autoDetect() — formulaInfo() with null fallback (default)
firstMatch(...) — try multiple filters in order
Changes to TinyExpressionP4LanguageServerExt:
- Add DocumentFilter field + two constructors (default: autoDetect())
- parseDocument() delegates to documentFilter.extract() instead of
calling extractFormulaSection() directly
- Remove inline 'record FormulaSection' (now a top-level class)
Usage example (custom Launcher for Markdown files):
new TinyExpressionP4LanguageServerExt(
DocumentFilter.fenced("```tinyexp", "```"))
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends DocumentFilter with a new legacy() strategy that preprocesses
documents containing constructs not in the P4 grammar, enabling them to
validate without errors:
- Fenced code blocks (```java:Foo ... ```) replaced with blank lines
- Import declarations (import ...;) replaced with blank lines
- External invocations (external returning as TYPE name(args)) rewritten
to call name(args) with space-padding to preserve character positions
autoDetect() now composes formulaInfo() + legacy() via firstMatch(), so
FormulaInfo files, legacy pre-P4 files, and plain P4 files are all handled
by the default filter without any server configuration.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds grammar-native support for pre-P4 constructs so they are properly
validated rather than silently masked:
- ImportDeclaration: import ClassName#method as alias;
Validates FQCN, '#' separator, 'as' alias syntax
- ExternalBooleanInvocation / ExternalNumberInvocation /
ExternalStringInvocation / ExternalObjectInvocation:
external returning as <type> funcName(args)
Validates return type keyword, method name, argument syntax
Formula root rule updated: { ImportDeclaration } precedes VariableDeclaration.
DocumentFilter.legacy() now only masks fenced Java blocks (```java:... ```)
since import and external are grammar-defined. Regular lines pass through
unchanged and are validated by the P4 parser.
Keywords 'import', 'external', 'returning' added to KEYWORD_SET and
COMPLETION_KEYWORDS for semantic highlighting and completion.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Generate 106 SVG railroad diagrams from complete UBNF grammar
- Create GitHub-compatible README.md with complete rule documentation
- Update grammar documentation to link to new railroad diagrams
- All diagrams are SVG and viewable directly in GitHub markdown
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add 'References:' section to each rule diagram
- References are markdown links to related NonTerminal rules
- Enables single-page navigation within README.md on GitHub
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@opaopa6969
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Feat java21 p4 lsp dap by opaopa6969 · Pull Request #2 · opaopa6969/tinyexpression · GitHub
Skip to content

Feat java21 p4 lsp dap - #2

Merged
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap
Mar 6, 2026
Merged

Feat java21 p4 lsp dap#2
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap

Conversation

@opaopa6969

Copy link
Copy Markdown
Owner

No description provided.

opaopa6969and others added 26 commits February 27, 2026 11:45
## Main project (tinyexpression)
- ExecutionBackend: add P4_AST_EVALUATOR and P4_DSL_JAVA_CODE enum entries
with fromRuntimeMode() aliases (p4-ast, p4-dsl-javacode)
- P4AstEvaluatorCalculator: type-safe P4 parser probe with fallback to
AstEvaluatorCalculator; records _tinyP4ParserUsed / _tinyP4AstNodeType
- P4DslJavaCodeCalculator: P4-parser override for DslJavaCodeCalculator
- CalculatorCreatorRegistry: register p4AstEvaluatorCreator() and
p4DslJavaCodeCreator(); add forBackend() switch entry
- TinyExpressionDapRuntimeBridge: copy _tinyP4ParserUsed and
_tinyP4AstNodeType markers in parity probe (6 backends)
- CommaParser: remove invalid @OverRide on expectedDisplayText()
(method not in SingleCharacterParser 2.4.0)
- Test compat fixes for unlaxer-common 2.4.0:
ParserTestBase (getTokenString→source), StringContentsTest,
TokenTest (int→CodePointIndex)
- P4BackendParityTest: 7 parity tests; all PASS
## Tools (tinyexpression-p4-lsp-vscode)
- UBNF grammar: tinyexpression-p4.ubnf
- pom.xml: generators=Parser,AST,Mapper,Evaluator,LSP,Launcher,DAP,DAPLauncher
- TinyExpressionP4LanguageServerExt: type-safe semantic tokens via
instanceof (no regex), ParseFailureDiagnostics sealed interface,
TE001 enriched diagnostics, keyword/variable completion
- TinyExpressionP4DebugAdapterExt: captures formula/runtimeMode in
launch(); adds _tinyP4ParserUsed / _tinyP4AstNodeType / _tinyP4AstNodePath
to DAP variables panel using sealed interface switch
- extension.ts: LSP via -jar, DAP via -cp with DapLauncherExt main class
- .gitignore + .vscodeignore: exclude node_modules/out/target/vsix
- server-dist/tinyexpression-p4-lsp-server.jar: fat jar (3.7 MB)
## Docs
- TINYEXPRESSION-P4-LSP-DAP-IMPL-PLAN.md: implementation plan
- TINYEXPRESSION-P4-LSP-DAP-TASKS.md: task tracker (89% complete)
- TINYEXPRESSION-P4-PIPELINE-GUIDE.md: beginner's guide to
UBNF→ParseTree→AST→Evaluator→LSP/DAP pipeline
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…LICENSE
- Remove `files` field from package.json (conflicts with .vscodeignore in vsce)
- Recreate .vscodeignore excluding node_modules, target, src, grammar, pom.xml
- Add README.md with features, quick-start, settings table, supported file patterns, architecture
- Add LICENSE (MIT) copied from calculator-lsp-vscode
- Add missing package.json fields: repository, homepage, bugs, author, publisher, activationEvents,
commands contribution, filenames/filenamePatterns for default/emergency files,
semanticTokenScopes, tinyExpressionP4Lsp.fileExtensions setting, package script
- VSIX now includes LICENSE automatically and builds cleanly at ~3.3 MB
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gging
Extension (TypeScript):
- Add `showServerOutput` command handler: calls outputChannel.show() so users can
inspect server logs and diagnose Java startup issues
- Add startup logging: logs java path, jar path and JVM args to output channel on activate()
- Add startup error notification: shows VS Code error message if client.start() rejects
Java LSP server:
- Add `codeActionProvider: true` to ServerCapabilities (initialize response)
- Implement `codeAction()` in ExtTextDocumentService:
- TE001 + starts with 'if': offer "Rewrite 'if' to P4 syntax" quick fix
- TE001 + bare funcName(): offer "Add 'call' keyword" quick fix
- TE001 (any): offer P4 syntax reference hint action
Version: 0.1.0 → 0.1.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause: vscode-languageclient and its transitive deps were not included
in the VSIX, causing `require('vscode-languageclient/node')` to fail at
load time → extension silently failed → no diagnostics, no command handler.
Fix:
- Switch `vscode:prepublish` from `tsc` to `esbuild --bundle`
- esbuild inlines vscode-languageclient + all transitive deps into out/extension.js
- Only `vscode` is kept external (provided by VS Code host)
- .vscodeignore: remove node_modules exception (no longer needed)
- Move showServerOutput registerCommand before LanguageClient setup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Problem: files with metadata headers (tags:, description:, etc.) were
causing TE001 errors on every line because the P4 parser was trying to
parse the full file content including the metadata section.
Fix:
- Add extractFormulaSection(): scans for 'formula:' line, extracts
formula content and its line-number offset within the document
- parseDocument() now routes to parseWithFormulaSection() when the
'formula:' marker is found, passing only the formula text to the parser
- publishEnrichedDiagnostics() accepts lineOffset: shifts diagnostic
range positions so they point into the correct lines in the full document
- computeSemanticTokens() accepts lineOffset: adds offset to token lines
so semantic highlighting lands on the formula section, not line 0
- ExtDocumentState gains lineOffset field
- Plain .tinyexp files (no 'formula:' marker) continue to work as before
- Windows \r\n line endings handled via .replace('\r', '') before comparison
Test:
tags:NORMAL / formula: / 1+2 / ---END_OF_PART--- → no diagnostics
tags:NORMAL / formula: / if @@@broken / --- → TE001 at line 3 ✓
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Motivation: real-world files mix non-formula content (metadata headers,
Markdown, etc.) with TinyExpression formulas. Rather than implementing a
full host-language parser, a lightweight DocumentFilter wrapper can strip
the non-formula parts so the P4 parser sees only valid input.
New files:
- FormulaSection.java — record(content, lineOffset): the extracted slice
- DocumentFilter.java — @FunctionalInterface with built-in implementations:
passThrough() — parse whole document (plain .tinyexp)
formulaInfo() — FormulaInfo 'formula:' / '---END_OF_PART---' format
fenced(open,close)— generic fence markers (e.g. "```tinyexp" / "```")
autoDetect() — formulaInfo() with null fallback (default)
firstMatch(...) — try multiple filters in order
Changes to TinyExpressionP4LanguageServerExt:
- Add DocumentFilter field + two constructors (default: autoDetect())
- parseDocument() delegates to documentFilter.extract() instead of
calling extractFormulaSection() directly
- Remove inline 'record FormulaSection' (now a top-level class)
Usage example (custom Launcher for Markdown files):
new TinyExpressionP4LanguageServerExt(
DocumentFilter.fenced("```tinyexp", "```"))
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends DocumentFilter with a new legacy() strategy that preprocesses
documents containing constructs not in the P4 grammar, enabling them to
validate without errors:
- Fenced code blocks (```java:Foo ... ```) replaced with blank lines
- Import declarations (import ...;) replaced with blank lines
- External invocations (external returning as TYPE name(args)) rewritten
to call name(args) with space-padding to preserve character positions
autoDetect() now composes formulaInfo() + legacy() via firstMatch(), so
FormulaInfo files, legacy pre-P4 files, and plain P4 files are all handled
by the default filter without any server configuration.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds grammar-native support for pre-P4 constructs so they are properly
validated rather than silently masked:
- ImportDeclaration: import ClassName#method as alias;
Validates FQCN, '#' separator, 'as' alias syntax
- ExternalBooleanInvocation / ExternalNumberInvocation /
ExternalStringInvocation / ExternalObjectInvocation:
external returning as <type> funcName(args)
Validates return type keyword, method name, argument syntax
Formula root rule updated: { ImportDeclaration } precedes VariableDeclaration.
DocumentFilter.legacy() now only masks fenced Java blocks (```java:... ```)
since import and external are grammar-defined. Regular lines pass through
unchanged and are validated by the P4 parser.
Keywords 'import', 'external', 'returning' added to KEYWORD_SET and
COMPLETION_KEYWORDS for semantic highlighting and completion.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Generate 106 SVG railroad diagrams from complete UBNF grammar
- Create GitHub-compatible README.md with complete rule documentation
- Update grammar documentation to link to new railroad diagrams
- All diagrams are SVG and viewable directly in GitHub markdown
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add 'References:' section to each rule diagram
- References are markdown links to related NonTerminal rules
- Enables single-page navigation within README.md on GitHub
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@opaopa6969
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Feat java21 p4 lsp dap by opaopa6969 · Pull Request #2 · opaopa6969/tinyexpression · GitHub
Skip to content

Feat java21 p4 lsp dap - #2

Merged
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap
Mar 6, 2026
Merged

Feat java21 p4 lsp dap#2
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap

Conversation

@opaopa6969

Copy link
Copy Markdown
Owner

No description provided.

opaopa6969and others added 26 commits February 27, 2026 11:45
## Main project (tinyexpression)
- ExecutionBackend: add P4_AST_EVALUATOR and P4_DSL_JAVA_CODE enum entries
with fromRuntimeMode() aliases (p4-ast, p4-dsl-javacode)
- P4AstEvaluatorCalculator: type-safe P4 parser probe with fallback to
AstEvaluatorCalculator; records _tinyP4ParserUsed / _tinyP4AstNodeType
- P4DslJavaCodeCalculator: P4-parser override for DslJavaCodeCalculator
- CalculatorCreatorRegistry: register p4AstEvaluatorCreator() and
p4DslJavaCodeCreator(); add forBackend() switch entry
- TinyExpressionDapRuntimeBridge: copy _tinyP4ParserUsed and
_tinyP4AstNodeType markers in parity probe (6 backends)
- CommaParser: remove invalid @OverRide on expectedDisplayText()
(method not in SingleCharacterParser 2.4.0)
- Test compat fixes for unlaxer-common 2.4.0:
ParserTestBase (getTokenString→source), StringContentsTest,
TokenTest (int→CodePointIndex)
- P4BackendParityTest: 7 parity tests; all PASS
## Tools (tinyexpression-p4-lsp-vscode)
- UBNF grammar: tinyexpression-p4.ubnf
- pom.xml: generators=Parser,AST,Mapper,Evaluator,LSP,Launcher,DAP,DAPLauncher
- TinyExpressionP4LanguageServerExt: type-safe semantic tokens via
instanceof (no regex), ParseFailureDiagnostics sealed interface,
TE001 enriched diagnostics, keyword/variable completion
- TinyExpressionP4DebugAdapterExt: captures formula/runtimeMode in
launch(); adds _tinyP4ParserUsed / _tinyP4AstNodeType / _tinyP4AstNodePath
to DAP variables panel using sealed interface switch
- extension.ts: LSP via -jar, DAP via -cp with DapLauncherExt main class
- .gitignore + .vscodeignore: exclude node_modules/out/target/vsix
- server-dist/tinyexpression-p4-lsp-server.jar: fat jar (3.7 MB)
## Docs
- TINYEXPRESSION-P4-LSP-DAP-IMPL-PLAN.md: implementation plan
- TINYEXPRESSION-P4-LSP-DAP-TASKS.md: task tracker (89% complete)
- TINYEXPRESSION-P4-PIPELINE-GUIDE.md: beginner's guide to
UBNF→ParseTree→AST→Evaluator→LSP/DAP pipeline
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…LICENSE
- Remove `files` field from package.json (conflicts with .vscodeignore in vsce)
- Recreate .vscodeignore excluding node_modules, target, src, grammar, pom.xml
- Add README.md with features, quick-start, settings table, supported file patterns, architecture
- Add LICENSE (MIT) copied from calculator-lsp-vscode
- Add missing package.json fields: repository, homepage, bugs, author, publisher, activationEvents,
commands contribution, filenames/filenamePatterns for default/emergency files,
semanticTokenScopes, tinyExpressionP4Lsp.fileExtensions setting, package script
- VSIX now includes LICENSE automatically and builds cleanly at ~3.3 MB
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gging
Extension (TypeScript):
- Add `showServerOutput` command handler: calls outputChannel.show() so users can
inspect server logs and diagnose Java startup issues
- Add startup logging: logs java path, jar path and JVM args to output channel on activate()
- Add startup error notification: shows VS Code error message if client.start() rejects
Java LSP server:
- Add `codeActionProvider: true` to ServerCapabilities (initialize response)
- Implement `codeAction()` in ExtTextDocumentService:
- TE001 + starts with 'if': offer "Rewrite 'if' to P4 syntax" quick fix
- TE001 + bare funcName(): offer "Add 'call' keyword" quick fix
- TE001 (any): offer P4 syntax reference hint action
Version: 0.1.0 → 0.1.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause: vscode-languageclient and its transitive deps were not included
in the VSIX, causing `require('vscode-languageclient/node')` to fail at
load time → extension silently failed → no diagnostics, no command handler.
Fix:
- Switch `vscode:prepublish` from `tsc` to `esbuild --bundle`
- esbuild inlines vscode-languageclient + all transitive deps into out/extension.js
- Only `vscode` is kept external (provided by VS Code host)
- .vscodeignore: remove node_modules exception (no longer needed)
- Move showServerOutput registerCommand before LanguageClient setup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Problem: files with metadata headers (tags:, description:, etc.) were
causing TE001 errors on every line because the P4 parser was trying to
parse the full file content including the metadata section.
Fix:
- Add extractFormulaSection(): scans for 'formula:' line, extracts
formula content and its line-number offset within the document
- parseDocument() now routes to parseWithFormulaSection() when the
'formula:' marker is found, passing only the formula text to the parser
- publishEnrichedDiagnostics() accepts lineOffset: shifts diagnostic
range positions so they point into the correct lines in the full document
- computeSemanticTokens() accepts lineOffset: adds offset to token lines
so semantic highlighting lands on the formula section, not line 0
- ExtDocumentState gains lineOffset field
- Plain .tinyexp files (no 'formula:' marker) continue to work as before
- Windows \r\n line endings handled via .replace('\r', '') before comparison
Test:
tags:NORMAL / formula: / 1+2 / ---END_OF_PART--- → no diagnostics
tags:NORMAL / formula: / if @@@broken / --- → TE001 at line 3 ✓
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Motivation: real-world files mix non-formula content (metadata headers,
Markdown, etc.) with TinyExpression formulas. Rather than implementing a
full host-language parser, a lightweight DocumentFilter wrapper can strip
the non-formula parts so the P4 parser sees only valid input.
New files:
- FormulaSection.java — record(content, lineOffset): the extracted slice
- DocumentFilter.java — @FunctionalInterface with built-in implementations:
passThrough() — parse whole document (plain .tinyexp)
formulaInfo() — FormulaInfo 'formula:' / '---END_OF_PART---' format
fenced(open,close)— generic fence markers (e.g. "```tinyexp" / "```")
autoDetect() — formulaInfo() with null fallback (default)
firstMatch(...) — try multiple filters in order
Changes to TinyExpressionP4LanguageServerExt:
- Add DocumentFilter field + two constructors (default: autoDetect())
- parseDocument() delegates to documentFilter.extract() instead of
calling extractFormulaSection() directly
- Remove inline 'record FormulaSection' (now a top-level class)
Usage example (custom Launcher for Markdown files):
new TinyExpressionP4LanguageServerExt(
DocumentFilter.fenced("```tinyexp", "```"))
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends DocumentFilter with a new legacy() strategy that preprocesses
documents containing constructs not in the P4 grammar, enabling them to
validate without errors:
- Fenced code blocks (```java:Foo ... ```) replaced with blank lines
- Import declarations (import ...;) replaced with blank lines
- External invocations (external returning as TYPE name(args)) rewritten
to call name(args) with space-padding to preserve character positions
autoDetect() now composes formulaInfo() + legacy() via firstMatch(), so
FormulaInfo files, legacy pre-P4 files, and plain P4 files are all handled
by the default filter without any server configuration.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds grammar-native support for pre-P4 constructs so they are properly
validated rather than silently masked:
- ImportDeclaration: import ClassName#method as alias;
Validates FQCN, '#' separator, 'as' alias syntax
- ExternalBooleanInvocation / ExternalNumberInvocation /
ExternalStringInvocation / ExternalObjectInvocation:
external returning as <type> funcName(args)
Validates return type keyword, method name, argument syntax
Formula root rule updated: { ImportDeclaration } precedes VariableDeclaration.
DocumentFilter.legacy() now only masks fenced Java blocks (```java:... ```)
since import and external are grammar-defined. Regular lines pass through
unchanged and are validated by the P4 parser.
Keywords 'import', 'external', 'returning' added to KEYWORD_SET and
COMPLETION_KEYWORDS for semantic highlighting and completion.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Generate 106 SVG railroad diagrams from complete UBNF grammar
- Create GitHub-compatible README.md with complete rule documentation
- Update grammar documentation to link to new railroad diagrams
- All diagrams are SVG and viewable directly in GitHub markdown
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add 'References:' section to each rule diagram
- References are markdown links to related NonTerminal rules
- Enables single-page navigation within README.md on GitHub
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@opaopa6969
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' Feat java21 p4 lsp dap by opaopa6969 · Pull Request #2 · opaopa6969/tinyexpression · GitHub
Skip to content

Feat java21 p4 lsp dap - #2

Merged
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap
Mar 6, 2026
Merged

Feat java21 p4 lsp dap#2
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap

Conversation

@opaopa6969

Copy link
Copy Markdown
Owner

No description provided.

opaopa6969and others added 26 commits February 27, 2026 11:45
## Main project (tinyexpression)
- ExecutionBackend: add P4_AST_EVALUATOR and P4_DSL_JAVA_CODE enum entries
with fromRuntimeMode() aliases (p4-ast, p4-dsl-javacode)
- P4AstEvaluatorCalculator: type-safe P4 parser probe with fallback to
AstEvaluatorCalculator; records _tinyP4ParserUsed / _tinyP4AstNodeType
- P4DslJavaCodeCalculator: P4-parser override for DslJavaCodeCalculator
- CalculatorCreatorRegistry: register p4AstEvaluatorCreator() and
p4DslJavaCodeCreator(); add forBackend() switch entry
- TinyExpressionDapRuntimeBridge: copy _tinyP4ParserUsed and
_tinyP4AstNodeType markers in parity probe (6 backends)
- CommaParser: remove invalid @OverRide on expectedDisplayText()
(method not in SingleCharacterParser 2.4.0)
- Test compat fixes for unlaxer-common 2.4.0:
ParserTestBase (getTokenString→source), StringContentsTest,
TokenTest (int→CodePointIndex)
- P4BackendParityTest: 7 parity tests; all PASS
## Tools (tinyexpression-p4-lsp-vscode)
- UBNF grammar: tinyexpression-p4.ubnf
- pom.xml: generators=Parser,AST,Mapper,Evaluator,LSP,Launcher,DAP,DAPLauncher
- TinyExpressionP4LanguageServerExt: type-safe semantic tokens via
instanceof (no regex), ParseFailureDiagnostics sealed interface,
TE001 enriched diagnostics, keyword/variable completion
- TinyExpressionP4DebugAdapterExt: captures formula/runtimeMode in
launch(); adds _tinyP4ParserUsed / _tinyP4AstNodeType / _tinyP4AstNodePath
to DAP variables panel using sealed interface switch
- extension.ts: LSP via -jar, DAP via -cp with DapLauncherExt main class
- .gitignore + .vscodeignore: exclude node_modules/out/target/vsix
- server-dist/tinyexpression-p4-lsp-server.jar: fat jar (3.7 MB)
## Docs
- TINYEXPRESSION-P4-LSP-DAP-IMPL-PLAN.md: implementation plan
- TINYEXPRESSION-P4-LSP-DAP-TASKS.md: task tracker (89% complete)
- TINYEXPRESSION-P4-PIPELINE-GUIDE.md: beginner's guide to
UBNF→ParseTree→AST→Evaluator→LSP/DAP pipeline
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…LICENSE
- Remove `files` field from package.json (conflicts with .vscodeignore in vsce)
- Recreate .vscodeignore excluding node_modules, target, src, grammar, pom.xml
- Add README.md with features, quick-start, settings table, supported file patterns, architecture
- Add LICENSE (MIT) copied from calculator-lsp-vscode
- Add missing package.json fields: repository, homepage, bugs, author, publisher, activationEvents,
commands contribution, filenames/filenamePatterns for default/emergency files,
semanticTokenScopes, tinyExpressionP4Lsp.fileExtensions setting, package script
- VSIX now includes LICENSE automatically and builds cleanly at ~3.3 MB
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gging
Extension (TypeScript):
- Add `showServerOutput` command handler: calls outputChannel.show() so users can
inspect server logs and diagnose Java startup issues
- Add startup logging: logs java path, jar path and JVM args to output channel on activate()
- Add startup error notification: shows VS Code error message if client.start() rejects
Java LSP server:
- Add `codeActionProvider: true` to ServerCapabilities (initialize response)
- Implement `codeAction()` in ExtTextDocumentService:
- TE001 + starts with 'if': offer "Rewrite 'if' to P4 syntax" quick fix
- TE001 + bare funcName(): offer "Add 'call' keyword" quick fix
- TE001 (any): offer P4 syntax reference hint action
Version: 0.1.0 → 0.1.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause: vscode-languageclient and its transitive deps were not included
in the VSIX, causing `require('vscode-languageclient/node')` to fail at
load time → extension silently failed → no diagnostics, no command handler.
Fix:
- Switch `vscode:prepublish` from `tsc` to `esbuild --bundle`
- esbuild inlines vscode-languageclient + all transitive deps into out/extension.js
- Only `vscode` is kept external (provided by VS Code host)
- .vscodeignore: remove node_modules exception (no longer needed)
- Move showServerOutput registerCommand before LanguageClient setup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Problem: files with metadata headers (tags:, description:, etc.) were
causing TE001 errors on every line because the P4 parser was trying to
parse the full file content including the metadata section.
Fix:
- Add extractFormulaSection(): scans for 'formula:' line, extracts
formula content and its line-number offset within the document
- parseDocument() now routes to parseWithFormulaSection() when the
'formula:' marker is found, passing only the formula text to the parser
- publishEnrichedDiagnostics() accepts lineOffset: shifts diagnostic
range positions so they point into the correct lines in the full document
- computeSemanticTokens() accepts lineOffset: adds offset to token lines
so semantic highlighting lands on the formula section, not line 0
- ExtDocumentState gains lineOffset field
- Plain .tinyexp files (no 'formula:' marker) continue to work as before
- Windows \r\n line endings handled via .replace('\r', '') before comparison
Test:
tags:NORMAL / formula: / 1+2 / ---END_OF_PART--- → no diagnostics
tags:NORMAL / formula: / if @@@broken / --- → TE001 at line 3 ✓
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Motivation: real-world files mix non-formula content (metadata headers,
Markdown, etc.) with TinyExpression formulas. Rather than implementing a
full host-language parser, a lightweight DocumentFilter wrapper can strip
the non-formula parts so the P4 parser sees only valid input.
New files:
- FormulaSection.java — record(content, lineOffset): the extracted slice
- DocumentFilter.java — @FunctionalInterface with built-in implementations:
passThrough() — parse whole document (plain .tinyexp)
formulaInfo() — FormulaInfo 'formula:' / '---END_OF_PART---' format
fenced(open,close)— generic fence markers (e.g. "```tinyexp" / "```")
autoDetect() — formulaInfo() with null fallback (default)
firstMatch(...) — try multiple filters in order
Changes to TinyExpressionP4LanguageServerExt:
- Add DocumentFilter field + two constructors (default: autoDetect())
- parseDocument() delegates to documentFilter.extract() instead of
calling extractFormulaSection() directly
- Remove inline 'record FormulaSection' (now a top-level class)
Usage example (custom Launcher for Markdown files):
new TinyExpressionP4LanguageServerExt(
DocumentFilter.fenced("```tinyexp", "```"))
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends DocumentFilter with a new legacy() strategy that preprocesses
documents containing constructs not in the P4 grammar, enabling them to
validate without errors:
- Fenced code blocks (```java:Foo ... ```) replaced with blank lines
- Import declarations (import ...;) replaced with blank lines
- External invocations (external returning as TYPE name(args)) rewritten
to call name(args) with space-padding to preserve character positions
autoDetect() now composes formulaInfo() + legacy() via firstMatch(), so
FormulaInfo files, legacy pre-P4 files, and plain P4 files are all handled
by the default filter without any server configuration.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds grammar-native support for pre-P4 constructs so they are properly
validated rather than silently masked:
- ImportDeclaration: import ClassName#method as alias;
Validates FQCN, '#' separator, 'as' alias syntax
- ExternalBooleanInvocation / ExternalNumberInvocation /
ExternalStringInvocation / ExternalObjectInvocation:
external returning as <type> funcName(args)
Validates return type keyword, method name, argument syntax
Formula root rule updated: { ImportDeclaration } precedes VariableDeclaration.
DocumentFilter.legacy() now only masks fenced Java blocks (```java:... ```)
since import and external are grammar-defined. Regular lines pass through
unchanged and are validated by the P4 parser.
Keywords 'import', 'external', 'returning' added to KEYWORD_SET and
COMPLETION_KEYWORDS for semantic highlighting and completion.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Generate 106 SVG railroad diagrams from complete UBNF grammar
- Create GitHub-compatible README.md with complete rule documentation
- Update grammar documentation to link to new railroad diagrams
- All diagrams are SVG and viewable directly in GitHub markdown
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add 'References:' section to each rule diagram
- References are markdown links to related NonTerminal rules
- Enables single-page navigation within README.md on GitHub
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@opaopa6969
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Feat java21 p4 lsp dap by opaopa6969 · Pull Request #2 · opaopa6969/tinyexpression · GitHub
Skip to content

Feat java21 p4 lsp dap - #2

Merged
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap
Mar 6, 2026
Merged

Feat java21 p4 lsp dap#2
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap

Conversation

@opaopa6969

Copy link
Copy Markdown
Owner

No description provided.

opaopa6969and others added 26 commits February 27, 2026 11:45
## Main project (tinyexpression)
- ExecutionBackend: add P4_AST_EVALUATOR and P4_DSL_JAVA_CODE enum entries
with fromRuntimeMode() aliases (p4-ast, p4-dsl-javacode)
- P4AstEvaluatorCalculator: type-safe P4 parser probe with fallback to
AstEvaluatorCalculator; records _tinyP4ParserUsed / _tinyP4AstNodeType
- P4DslJavaCodeCalculator: P4-parser override for DslJavaCodeCalculator
- CalculatorCreatorRegistry: register p4AstEvaluatorCreator() and
p4DslJavaCodeCreator(); add forBackend() switch entry
- TinyExpressionDapRuntimeBridge: copy _tinyP4ParserUsed and
_tinyP4AstNodeType markers in parity probe (6 backends)
- CommaParser: remove invalid @OverRide on expectedDisplayText()
(method not in SingleCharacterParser 2.4.0)
- Test compat fixes for unlaxer-common 2.4.0:
ParserTestBase (getTokenString→source), StringContentsTest,
TokenTest (int→CodePointIndex)
- P4BackendParityTest: 7 parity tests; all PASS
## Tools (tinyexpression-p4-lsp-vscode)
- UBNF grammar: tinyexpression-p4.ubnf
- pom.xml: generators=Parser,AST,Mapper,Evaluator,LSP,Launcher,DAP,DAPLauncher
- TinyExpressionP4LanguageServerExt: type-safe semantic tokens via
instanceof (no regex), ParseFailureDiagnostics sealed interface,
TE001 enriched diagnostics, keyword/variable completion
- TinyExpressionP4DebugAdapterExt: captures formula/runtimeMode in
launch(); adds _tinyP4ParserUsed / _tinyP4AstNodeType / _tinyP4AstNodePath
to DAP variables panel using sealed interface switch
- extension.ts: LSP via -jar, DAP via -cp with DapLauncherExt main class
- .gitignore + .vscodeignore: exclude node_modules/out/target/vsix
- server-dist/tinyexpression-p4-lsp-server.jar: fat jar (3.7 MB)
## Docs
- TINYEXPRESSION-P4-LSP-DAP-IMPL-PLAN.md: implementation plan
- TINYEXPRESSION-P4-LSP-DAP-TASKS.md: task tracker (89% complete)
- TINYEXPRESSION-P4-PIPELINE-GUIDE.md: beginner's guide to
UBNF→ParseTree→AST→Evaluator→LSP/DAP pipeline
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…LICENSE
- Remove `files` field from package.json (conflicts with .vscodeignore in vsce)
- Recreate .vscodeignore excluding node_modules, target, src, grammar, pom.xml
- Add README.md with features, quick-start, settings table, supported file patterns, architecture
- Add LICENSE (MIT) copied from calculator-lsp-vscode
- Add missing package.json fields: repository, homepage, bugs, author, publisher, activationEvents,
commands contribution, filenames/filenamePatterns for default/emergency files,
semanticTokenScopes, tinyExpressionP4Lsp.fileExtensions setting, package script
- VSIX now includes LICENSE automatically and builds cleanly at ~3.3 MB
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gging
Extension (TypeScript):
- Add `showServerOutput` command handler: calls outputChannel.show() so users can
inspect server logs and diagnose Java startup issues
- Add startup logging: logs java path, jar path and JVM args to output channel on activate()
- Add startup error notification: shows VS Code error message if client.start() rejects
Java LSP server:
- Add `codeActionProvider: true` to ServerCapabilities (initialize response)
- Implement `codeAction()` in ExtTextDocumentService:
- TE001 + starts with 'if': offer "Rewrite 'if' to P4 syntax" quick fix
- TE001 + bare funcName(): offer "Add 'call' keyword" quick fix
- TE001 (any): offer P4 syntax reference hint action
Version: 0.1.0 → 0.1.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause: vscode-languageclient and its transitive deps were not included
in the VSIX, causing `require('vscode-languageclient/node')` to fail at
load time → extension silently failed → no diagnostics, no command handler.
Fix:
- Switch `vscode:prepublish` from `tsc` to `esbuild --bundle`
- esbuild inlines vscode-languageclient + all transitive deps into out/extension.js
- Only `vscode` is kept external (provided by VS Code host)
- .vscodeignore: remove node_modules exception (no longer needed)
- Move showServerOutput registerCommand before LanguageClient setup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Problem: files with metadata headers (tags:, description:, etc.) were
causing TE001 errors on every line because the P4 parser was trying to
parse the full file content including the metadata section.
Fix:
- Add extractFormulaSection(): scans for 'formula:' line, extracts
formula content and its line-number offset within the document
- parseDocument() now routes to parseWithFormulaSection() when the
'formula:' marker is found, passing only the formula text to the parser
- publishEnrichedDiagnostics() accepts lineOffset: shifts diagnostic
range positions so they point into the correct lines in the full document
- computeSemanticTokens() accepts lineOffset: adds offset to token lines
so semantic highlighting lands on the formula section, not line 0
- ExtDocumentState gains lineOffset field
- Plain .tinyexp files (no 'formula:' marker) continue to work as before
- Windows \r\n line endings handled via .replace('\r', '') before comparison
Test:
tags:NORMAL / formula: / 1+2 / ---END_OF_PART--- → no diagnostics
tags:NORMAL / formula: / if @@@broken / --- → TE001 at line 3 ✓
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Motivation: real-world files mix non-formula content (metadata headers,
Markdown, etc.) with TinyExpression formulas. Rather than implementing a
full host-language parser, a lightweight DocumentFilter wrapper can strip
the non-formula parts so the P4 parser sees only valid input.
New files:
- FormulaSection.java — record(content, lineOffset): the extracted slice
- DocumentFilter.java — @FunctionalInterface with built-in implementations:
passThrough() — parse whole document (plain .tinyexp)
formulaInfo() — FormulaInfo 'formula:' / '---END_OF_PART---' format
fenced(open,close)— generic fence markers (e.g. "```tinyexp" / "```")
autoDetect() — formulaInfo() with null fallback (default)
firstMatch(...) — try multiple filters in order
Changes to TinyExpressionP4LanguageServerExt:
- Add DocumentFilter field + two constructors (default: autoDetect())
- parseDocument() delegates to documentFilter.extract() instead of
calling extractFormulaSection() directly
- Remove inline 'record FormulaSection' (now a top-level class)
Usage example (custom Launcher for Markdown files):
new TinyExpressionP4LanguageServerExt(
DocumentFilter.fenced("```tinyexp", "```"))
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends DocumentFilter with a new legacy() strategy that preprocesses
documents containing constructs not in the P4 grammar, enabling them to
validate without errors:
- Fenced code blocks (```java:Foo ... ```) replaced with blank lines
- Import declarations (import ...;) replaced with blank lines
- External invocations (external returning as TYPE name(args)) rewritten
to call name(args) with space-padding to preserve character positions
autoDetect() now composes formulaInfo() + legacy() via firstMatch(), so
FormulaInfo files, legacy pre-P4 files, and plain P4 files are all handled
by the default filter without any server configuration.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds grammar-native support for pre-P4 constructs so they are properly
validated rather than silently masked:
- ImportDeclaration: import ClassName#method as alias;
Validates FQCN, '#' separator, 'as' alias syntax
- ExternalBooleanInvocation / ExternalNumberInvocation /
ExternalStringInvocation / ExternalObjectInvocation:
external returning as <type> funcName(args)
Validates return type keyword, method name, argument syntax
Formula root rule updated: { ImportDeclaration } precedes VariableDeclaration.
DocumentFilter.legacy() now only masks fenced Java blocks (```java:... ```)
since import and external are grammar-defined. Regular lines pass through
unchanged and are validated by the P4 parser.
Keywords 'import', 'external', 'returning' added to KEYWORD_SET and
COMPLETION_KEYWORDS for semantic highlighting and completion.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Generate 106 SVG railroad diagrams from complete UBNF grammar
- Create GitHub-compatible README.md with complete rule documentation
- Update grammar documentation to link to new railroad diagrams
- All diagrams are SVG and viewable directly in GitHub markdown
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add 'References:' section to each rule diagram
- References are markdown links to related NonTerminal rules
- Enables single-page navigation within README.md on GitHub
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@opaopa6969
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Feat java21 p4 lsp dap by opaopa6969 · Pull Request #2 · opaopa6969/tinyexpression · GitHub
Skip to content

Feat java21 p4 lsp dap - #2

Merged
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap
Mar 6, 2026
Merged

Feat java21 p4 lsp dap#2
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap

Conversation

@opaopa6969

Copy link
Copy Markdown
Owner

No description provided.

opaopa6969and others added 26 commits February 27, 2026 11:45
## Main project (tinyexpression)
- ExecutionBackend: add P4_AST_EVALUATOR and P4_DSL_JAVA_CODE enum entries
with fromRuntimeMode() aliases (p4-ast, p4-dsl-javacode)
- P4AstEvaluatorCalculator: type-safe P4 parser probe with fallback to
AstEvaluatorCalculator; records _tinyP4ParserUsed / _tinyP4AstNodeType
- P4DslJavaCodeCalculator: P4-parser override for DslJavaCodeCalculator
- CalculatorCreatorRegistry: register p4AstEvaluatorCreator() and
p4DslJavaCodeCreator(); add forBackend() switch entry
- TinyExpressionDapRuntimeBridge: copy _tinyP4ParserUsed and
_tinyP4AstNodeType markers in parity probe (6 backends)
- CommaParser: remove invalid @OverRide on expectedDisplayText()
(method not in SingleCharacterParser 2.4.0)
- Test compat fixes for unlaxer-common 2.4.0:
ParserTestBase (getTokenString→source), StringContentsTest,
TokenTest (int→CodePointIndex)
- P4BackendParityTest: 7 parity tests; all PASS
## Tools (tinyexpression-p4-lsp-vscode)
- UBNF grammar: tinyexpression-p4.ubnf
- pom.xml: generators=Parser,AST,Mapper,Evaluator,LSP,Launcher,DAP,DAPLauncher
- TinyExpressionP4LanguageServerExt: type-safe semantic tokens via
instanceof (no regex), ParseFailureDiagnostics sealed interface,
TE001 enriched diagnostics, keyword/variable completion
- TinyExpressionP4DebugAdapterExt: captures formula/runtimeMode in
launch(); adds _tinyP4ParserUsed / _tinyP4AstNodeType / _tinyP4AstNodePath
to DAP variables panel using sealed interface switch
- extension.ts: LSP via -jar, DAP via -cp with DapLauncherExt main class
- .gitignore + .vscodeignore: exclude node_modules/out/target/vsix
- server-dist/tinyexpression-p4-lsp-server.jar: fat jar (3.7 MB)
## Docs
- TINYEXPRESSION-P4-LSP-DAP-IMPL-PLAN.md: implementation plan
- TINYEXPRESSION-P4-LSP-DAP-TASKS.md: task tracker (89% complete)
- TINYEXPRESSION-P4-PIPELINE-GUIDE.md: beginner's guide to
UBNF→ParseTree→AST→Evaluator→LSP/DAP pipeline
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…LICENSE
- Remove `files` field from package.json (conflicts with .vscodeignore in vsce)
- Recreate .vscodeignore excluding node_modules, target, src, grammar, pom.xml
- Add README.md with features, quick-start, settings table, supported file patterns, architecture
- Add LICENSE (MIT) copied from calculator-lsp-vscode
- Add missing package.json fields: repository, homepage, bugs, author, publisher, activationEvents,
commands contribution, filenames/filenamePatterns for default/emergency files,
semanticTokenScopes, tinyExpressionP4Lsp.fileExtensions setting, package script
- VSIX now includes LICENSE automatically and builds cleanly at ~3.3 MB
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gging
Extension (TypeScript):
- Add `showServerOutput` command handler: calls outputChannel.show() so users can
inspect server logs and diagnose Java startup issues
- Add startup logging: logs java path, jar path and JVM args to output channel on activate()
- Add startup error notification: shows VS Code error message if client.start() rejects
Java LSP server:
- Add `codeActionProvider: true` to ServerCapabilities (initialize response)
- Implement `codeAction()` in ExtTextDocumentService:
- TE001 + starts with 'if': offer "Rewrite 'if' to P4 syntax" quick fix
- TE001 + bare funcName(): offer "Add 'call' keyword" quick fix
- TE001 (any): offer P4 syntax reference hint action
Version: 0.1.0 → 0.1.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause: vscode-languageclient and its transitive deps were not included
in the VSIX, causing `require('vscode-languageclient/node')` to fail at
load time → extension silently failed → no diagnostics, no command handler.
Fix:
- Switch `vscode:prepublish` from `tsc` to `esbuild --bundle`
- esbuild inlines vscode-languageclient + all transitive deps into out/extension.js
- Only `vscode` is kept external (provided by VS Code host)
- .vscodeignore: remove node_modules exception (no longer needed)
- Move showServerOutput registerCommand before LanguageClient setup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Problem: files with metadata headers (tags:, description:, etc.) were
causing TE001 errors on every line because the P4 parser was trying to
parse the full file content including the metadata section.
Fix:
- Add extractFormulaSection(): scans for 'formula:' line, extracts
formula content and its line-number offset within the document
- parseDocument() now routes to parseWithFormulaSection() when the
'formula:' marker is found, passing only the formula text to the parser
- publishEnrichedDiagnostics() accepts lineOffset: shifts diagnostic
range positions so they point into the correct lines in the full document
- computeSemanticTokens() accepts lineOffset: adds offset to token lines
so semantic highlighting lands on the formula section, not line 0
- ExtDocumentState gains lineOffset field
- Plain .tinyexp files (no 'formula:' marker) continue to work as before
- Windows \r\n line endings handled via .replace('\r', '') before comparison
Test:
tags:NORMAL / formula: / 1+2 / ---END_OF_PART--- → no diagnostics
tags:NORMAL / formula: / if @@@broken / --- → TE001 at line 3 ✓
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Motivation: real-world files mix non-formula content (metadata headers,
Markdown, etc.) with TinyExpression formulas. Rather than implementing a
full host-language parser, a lightweight DocumentFilter wrapper can strip
the non-formula parts so the P4 parser sees only valid input.
New files:
- FormulaSection.java — record(content, lineOffset): the extracted slice
- DocumentFilter.java — @FunctionalInterface with built-in implementations:
passThrough() — parse whole document (plain .tinyexp)
formulaInfo() — FormulaInfo 'formula:' / '---END_OF_PART---' format
fenced(open,close)— generic fence markers (e.g. "```tinyexp" / "```")
autoDetect() — formulaInfo() with null fallback (default)
firstMatch(...) — try multiple filters in order
Changes to TinyExpressionP4LanguageServerExt:
- Add DocumentFilter field + two constructors (default: autoDetect())
- parseDocument() delegates to documentFilter.extract() instead of
calling extractFormulaSection() directly
- Remove inline 'record FormulaSection' (now a top-level class)
Usage example (custom Launcher for Markdown files):
new TinyExpressionP4LanguageServerExt(
DocumentFilter.fenced("```tinyexp", "```"))
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends DocumentFilter with a new legacy() strategy that preprocesses
documents containing constructs not in the P4 grammar, enabling them to
validate without errors:
- Fenced code blocks (```java:Foo ... ```) replaced with blank lines
- Import declarations (import ...;) replaced with blank lines
- External invocations (external returning as TYPE name(args)) rewritten
to call name(args) with space-padding to preserve character positions
autoDetect() now composes formulaInfo() + legacy() via firstMatch(), so
FormulaInfo files, legacy pre-P4 files, and plain P4 files are all handled
by the default filter without any server configuration.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds grammar-native support for pre-P4 constructs so they are properly
validated rather than silently masked:
- ImportDeclaration: import ClassName#method as alias;
Validates FQCN, '#' separator, 'as' alias syntax
- ExternalBooleanInvocation / ExternalNumberInvocation /
ExternalStringInvocation / ExternalObjectInvocation:
external returning as <type> funcName(args)
Validates return type keyword, method name, argument syntax
Formula root rule updated: { ImportDeclaration } precedes VariableDeclaration.
DocumentFilter.legacy() now only masks fenced Java blocks (```java:... ```)
since import and external are grammar-defined. Regular lines pass through
unchanged and are validated by the P4 parser.
Keywords 'import', 'external', 'returning' added to KEYWORD_SET and
COMPLETION_KEYWORDS for semantic highlighting and completion.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Generate 106 SVG railroad diagrams from complete UBNF grammar
- Create GitHub-compatible README.md with complete rule documentation
- Update grammar documentation to link to new railroad diagrams
- All diagrams are SVG and viewable directly in GitHub markdown
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add 'References:' section to each rule diagram
- References are markdown links to related NonTerminal rules
- Enables single-page navigation within README.md on GitHub
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@opaopa6969
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); Feat java21 p4 lsp dap by opaopa6969 · Pull Request #2 · opaopa6969/tinyexpression · GitHub
Skip to content

Feat java21 p4 lsp dap - #2

Merged
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap
Mar 6, 2026
Merged

Feat java21 p4 lsp dap#2
opaopa6969 merged 163 commits into
masterfrom
feat-java21-p4-lsp-dap

Conversation

@opaopa6969

Copy link
Copy Markdown
Owner

No description provided.

opaopa6969and others added 26 commits February 27, 2026 11:45
## Main project (tinyexpression)
- ExecutionBackend: add P4_AST_EVALUATOR and P4_DSL_JAVA_CODE enum entries
with fromRuntimeMode() aliases (p4-ast, p4-dsl-javacode)
- P4AstEvaluatorCalculator: type-safe P4 parser probe with fallback to
AstEvaluatorCalculator; records _tinyP4ParserUsed / _tinyP4AstNodeType
- P4DslJavaCodeCalculator: P4-parser override for DslJavaCodeCalculator
- CalculatorCreatorRegistry: register p4AstEvaluatorCreator() and
p4DslJavaCodeCreator(); add forBackend() switch entry
- TinyExpressionDapRuntimeBridge: copy _tinyP4ParserUsed and
_tinyP4AstNodeType markers in parity probe (6 backends)
- CommaParser: remove invalid @OverRide on expectedDisplayText()
(method not in SingleCharacterParser 2.4.0)
- Test compat fixes for unlaxer-common 2.4.0:
ParserTestBase (getTokenString→source), StringContentsTest,
TokenTest (int→CodePointIndex)
- P4BackendParityTest: 7 parity tests; all PASS
## Tools (tinyexpression-p4-lsp-vscode)
- UBNF grammar: tinyexpression-p4.ubnf
- pom.xml: generators=Parser,AST,Mapper,Evaluator,LSP,Launcher,DAP,DAPLauncher
- TinyExpressionP4LanguageServerExt: type-safe semantic tokens via
instanceof (no regex), ParseFailureDiagnostics sealed interface,
TE001 enriched diagnostics, keyword/variable completion
- TinyExpressionP4DebugAdapterExt: captures formula/runtimeMode in
launch(); adds _tinyP4ParserUsed / _tinyP4AstNodeType / _tinyP4AstNodePath
to DAP variables panel using sealed interface switch
- extension.ts: LSP via -jar, DAP via -cp with DapLauncherExt main class
- .gitignore + .vscodeignore: exclude node_modules/out/target/vsix
- server-dist/tinyexpression-p4-lsp-server.jar: fat jar (3.7 MB)
## Docs
- TINYEXPRESSION-P4-LSP-DAP-IMPL-PLAN.md: implementation plan
- TINYEXPRESSION-P4-LSP-DAP-TASKS.md: task tracker (89% complete)
- TINYEXPRESSION-P4-PIPELINE-GUIDE.md: beginner's guide to
UBNF→ParseTree→AST→Evaluator→LSP/DAP pipeline
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…LICENSE
- Remove `files` field from package.json (conflicts with .vscodeignore in vsce)
- Recreate .vscodeignore excluding node_modules, target, src, grammar, pom.xml
- Add README.md with features, quick-start, settings table, supported file patterns, architecture
- Add LICENSE (MIT) copied from calculator-lsp-vscode
- Add missing package.json fields: repository, homepage, bugs, author, publisher, activationEvents,
commands contribution, filenames/filenamePatterns for default/emergency files,
semanticTokenScopes, tinyExpressionP4Lsp.fileExtensions setting, package script
- VSIX now includes LICENSE automatically and builds cleanly at ~3.3 MB
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gging
Extension (TypeScript):
- Add `showServerOutput` command handler: calls outputChannel.show() so users can
inspect server logs and diagnose Java startup issues
- Add startup logging: logs java path, jar path and JVM args to output channel on activate()
- Add startup error notification: shows VS Code error message if client.start() rejects
Java LSP server:
- Add `codeActionProvider: true` to ServerCapabilities (initialize response)
- Implement `codeAction()` in ExtTextDocumentService:
- TE001 + starts with 'if': offer "Rewrite 'if' to P4 syntax" quick fix
- TE001 + bare funcName(): offer "Add 'call' keyword" quick fix
- TE001 (any): offer P4 syntax reference hint action
Version: 0.1.0 → 0.1.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause: vscode-languageclient and its transitive deps were not included
in the VSIX, causing `require('vscode-languageclient/node')` to fail at
load time → extension silently failed → no diagnostics, no command handler.
Fix:
- Switch `vscode:prepublish` from `tsc` to `esbuild --bundle`
- esbuild inlines vscode-languageclient + all transitive deps into out/extension.js
- Only `vscode` is kept external (provided by VS Code host)
- .vscodeignore: remove node_modules exception (no longer needed)
- Move showServerOutput registerCommand before LanguageClient setup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Problem: files with metadata headers (tags:, description:, etc.) were
causing TE001 errors on every line because the P4 parser was trying to
parse the full file content including the metadata section.
Fix:
- Add extractFormulaSection(): scans for 'formula:' line, extracts
formula content and its line-number offset within the document
- parseDocument() now routes to parseWithFormulaSection() when the
'formula:' marker is found, passing only the formula text to the parser
- publishEnrichedDiagnostics() accepts lineOffset: shifts diagnostic
range positions so they point into the correct lines in the full document
- computeSemanticTokens() accepts lineOffset: adds offset to token lines
so semantic highlighting lands on the formula section, not line 0
- ExtDocumentState gains lineOffset field
- Plain .tinyexp files (no 'formula:' marker) continue to work as before
- Windows \r\n line endings handled via .replace('\r', '') before comparison
Test:
tags:NORMAL / formula: / 1+2 / ---END_OF_PART--- → no diagnostics
tags:NORMAL / formula: / if @@@broken / --- → TE001 at line 3 ✓
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Motivation: real-world files mix non-formula content (metadata headers,
Markdown, etc.) with TinyExpression formulas. Rather than implementing a
full host-language parser, a lightweight DocumentFilter wrapper can strip
the non-formula parts so the P4 parser sees only valid input.
New files:
- FormulaSection.java — record(content, lineOffset): the extracted slice
- DocumentFilter.java — @FunctionalInterface with built-in implementations:
passThrough() — parse whole document (plain .tinyexp)
formulaInfo() — FormulaInfo 'formula:' / '---END_OF_PART---' format
fenced(open,close)— generic fence markers (e.g. "```tinyexp" / "```")
autoDetect() — formulaInfo() with null fallback (default)
firstMatch(...) — try multiple filters in order
Changes to TinyExpressionP4LanguageServerExt:
- Add DocumentFilter field + two constructors (default: autoDetect())
- parseDocument() delegates to documentFilter.extract() instead of
calling extractFormulaSection() directly
- Remove inline 'record FormulaSection' (now a top-level class)
Usage example (custom Launcher for Markdown files):
new TinyExpressionP4LanguageServerExt(
DocumentFilter.fenced("```tinyexp", "```"))
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends DocumentFilter with a new legacy() strategy that preprocesses
documents containing constructs not in the P4 grammar, enabling them to
validate without errors:
- Fenced code blocks (```java:Foo ... ```) replaced with blank lines
- Import declarations (import ...;) replaced with blank lines
- External invocations (external returning as TYPE name(args)) rewritten
to call name(args) with space-padding to preserve character positions
autoDetect() now composes formulaInfo() + legacy() via firstMatch(), so
FormulaInfo files, legacy pre-P4 files, and plain P4 files are all handled
by the default filter without any server configuration.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds grammar-native support for pre-P4 constructs so they are properly
validated rather than silently masked:
- ImportDeclaration: import ClassName#method as alias;
Validates FQCN, '#' separator, 'as' alias syntax
- ExternalBooleanInvocation / ExternalNumberInvocation /
ExternalStringInvocation / ExternalObjectInvocation:
external returning as <type> funcName(args)
Validates return type keyword, method name, argument syntax
Formula root rule updated: { ImportDeclaration } precedes VariableDeclaration.
DocumentFilter.legacy() now only masks fenced Java blocks (```java:... ```)
since import and external are grammar-defined. Regular lines pass through
unchanged and are validated by the P4 parser.
Keywords 'import', 'external', 'returning' added to KEYWORD_SET and
COMPLETION_KEYWORDS for semantic highlighting and completion.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Generate 106 SVG railroad diagrams from complete UBNF grammar
- Create GitHub-compatible README.md with complete rule documentation
- Update grammar documentation to link to new railroad diagrams
- All diagrams are SVG and viewable directly in GitHub markdown
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add 'References:' section to each rule diagram
- References are markdown links to related NonTerminal rules
- Enables single-page navigation within README.md on GitHub
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@opaopa6969