You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 38e6dd0
Browse filesBrowse the repository at this point in the historyBrowse files
Two extraction fixes for legacy tag-based CFML/ColdFusion, where the
vendored cfmleditor grammar (Lucee-tuned, script-first) leaves most
real-world components unextracted.
1. .cfc dialect disambiguation (cbm_disambiguate_cfc)
The extension table maps .cfc -> cfscript unconditionally, but legacy
codebases are predominantly tag-based (<cfcomponent>). Content-sniff the
file head, mirroring cbm_disambiguate_cls/inc: <cfcomponent>/<cffunction>
route to the cfml tag grammar; a leading <cfscript>-wrapped "component {}"
or a plain script component route to cfscript; leading <!--- ---> comments
are skipped.
2. Embedded <cfscript> definition extraction (cbm_extract_embedded_defs)
The HTML-derived cfml grammar keeps <cfscript> bodies as opaque
cf_script_content, so script functions inside tag components were never
extracted. Re-parse cf_script_tag -> cf_script_content slices with the
cfscript grammar (reusing the embedded-imports machinery) and walk them
for definitions via a new cbm_extract_definitions_body() that skips the
Module node. Block-relative line numbers are shifted by the block's start
row; CBMDefinition carries only line positions, so a constant offset is a
complete remap. Definitions only (calls/usages would need byte remapping),
so existing edges cannot be corrupted. As a bonus, functions are recovered
even when a <cfsetting> void-tag ERROR cascade damages the surrounding tree.
The opt-in is an extract_definitions flag on CBMEmbeddedLangSpec (carried by
CFML's embedded_imports entry), not a new CBMLangSpec field -- the latter
would trip -Wmissing-field-initializers across every language row under
clang -Werror.
Tests: extract_cfml_embedded_cfscript_defs (extraction + line remap) and
eight lang_cfc_* disambiguation cases. Verified on a ~700-file legacy CFML
codebase: parse timeouts 4->0, api.cfc 0->62 functions, +1,532 function
nodes overall, with exact line numbers.
Signed-off-by: Allan Oepping <allan@intellipay.com>
0 commit comments