Add ucode language - #8043
Open
janeblower wants to merge 3 commits into
Open
Conversation
janeblower
marked this pull request as ready for review
July 1, 2026 04:54
lildude
requested changes
Jul 21, 2026
lildude
left a comment
Member
There was a problem hiding this comment.
samples/ucode/http.uc is too big - of it's suppressed by the diff, it's too big for it needs - please replace it with a smaller sample.
Replace samples/ucode/http.uc with sys.uc from luci-base: same Apache-2.0 upstream, about a quarter of the size, and it still covers the import/export, builtin call and template string constructs the .uc heuristic keys on.
Author
|
|
UnrealScript has owned .uc since long before ucode existed, so anything without a ucode marker should stay UnrealScript rather than being handed to the statistical classifier, which has far more ucode samples to lean on.
Author
|
@lildude I fixed it. Can you check it? |
Author
|
@lildude |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This adds detection and syntax highlighting for ucode, the JavaScript-like scripting language created for OpenWrt (interpreter by Jo-Philipp Wich). It is widely used across the OpenWrt ecosystem —
openwrt/openwrt,openwrt/luci, and a large number ofluci-app-*and related package repositories — for rpcd backends, LuCI controllers/dispatchers, and CLI utilities.ucode's primary extension
.ucis already registered to UnrealScript, so this is a shared-extension addition:.ucextension;.ucsamples, and this PR adds three ucode samples;heuristics.ymlto disambiguate the two. ucode is matched on markers that never appear in UnrealScript (the#!/usr/bin/ucodeshebang,'use strict', ESimport/export,require(/include(,letbindings,printf/sprintf), and UnrealScript on its own markers (class X extends Y,defaultproperties,var(...),#exec,simulated/exec/nativefunction modifiers).letis used rather thanconstbecause UnrealScript also hasconst.test_uc_by_heuristics) asserts both directions classify correctly.Checklist:
path:*.uccount is dominated by UnrealScript, so these use ucode-specific keywords):2d05d310f53bac580808611dc4c70e95b22fee1bsource.ucode, MIT)#00b8d4