Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add support for Curv #411

Open
yh15kla9 opened this issue Mar 21, 2025 · 5 comments
Open

Please add support for Curv #411

yh15kla9 opened this issue Mar 21, 2025 · 5 comments
Assignees
Labels
enhancement New feature or request syntax highlight

Comments

@yh15kla9
Copy link

Website: https://curv3d.org/

Notepad++ UDL:

https://codeberg.org/doug-moen/curv/src/branch/master/lib/Curv_notepad_plusplus.xml

@SpartanJ SpartanJ self-assigned this Mar 22, 2025
@SpartanJ SpartanJ added enhancement New feature or request syntax highlight labels Mar 22, 2025
@Curculigo
Copy link

Extracted from this XML:

Keywords1: show_ifield i_linear i_radial i_concentric i_gyroid i_animate

Keywords2: complement union difference intersection symmetric_difference row smooth chamfer

Keywords3: move rotate reflect scale at stretch shear local_taper_x local_taper_xy twist bend colour extrude revolve repeat offset shell pancake morph loft perimeter_extrude make_texture texture swirl

Keywords4: circle ellipse square rect regular_polygon polygon vertices stroke polyline half_plane slice sphere ellipsoid cylinder cone capped_cone torus box prism tetrahedron cube octahedron dodecahedron icosahedron capsule half_space gyroid make_shape dist nothing everything

Keywords5: if else for let in do local until while by exec select parametric

Keywords6: pi tau phi e abs sign floor ceil trunc round frac max min sum product sort mod rem sqrt log clamp lerp smoothstep deg sin cos tan cis asin acos atan phase sec csc cot sinh cosh tanh asinh acosh atanh mag cmul csqr not and or xor bit mag normalize dot cis perp cross idmatrix transpose count concat reverse map filter reduce contains defined fields merge match call compose id

Keywords7: file include lipschitz show_axes show_bbox set_bbox show_dist show_gradient

Keywords8: is_bool is_num is_symbol is_string is_list is_record is_vec2 is_vec3 is_func is_primitive_func ensure test print warning error assert assert_error

@SpartanJ This language has so many keywords. As I know, ecode only supports up to keyword2. What will happen if I specify it to be keyword3, keyword4,...? They will have the same color? Or no color at all because they are invalid?

@SpartanJ
Copy link
Owner

"keywords" are just used to identify each set of symbols between a group, in a highlighter case it's just a reference for a color in a set. In this case there was a coincidence that they use also "keyword[number]" to refer for these group sets, but it's not necessary to match 1 to 1 or anything like that, you'll just need to pick a color for each group.

Current colors are (i'll add this to the documentation after this post):

"normal": non highlighted words this is the default color
"comment": code comments color
"keyword": mostly used for language reserved words (if, else, class, struct, then, enum, etc)
"keyword2": mostly used for type names
"keyword3": currently used for coloring parameters but can be used for anything
"number": number colors
"literal": word literals colors (usually things like NULL, true, false, undefined, etc). Can be used also for any particular symbol
"string": string colors
"operator": operators colors (+, -, =, <, >, etc)
"function": function name color
"link": any link color
"link_hover"; any link that's being hovered color

So you can basically use any of these for coloring Curv keywords groups.
It's possible adding more keywords for coloring very very easily but I didn't want to make it too complex (since in order to this work properly you'll need to add the color in each color scheme, although some of these keywords fallback to other keywords if they're not declared, for example keyword3 is one of those because it was added later), maybe it's time for keyword4 haha.

@Curculigo
Copy link

It's up to the OP who is the user of this language and is assumed to understand this language to categorize these keywords into keyword and keyword2. The problem with this kind of languages is they consider functions as keywords (think about BASIC).

@1muhgcmg
Copy link

@SpartanJ Is symbol the same as normal?

@SpartanJ
Copy link
Owner

SpartanJ commented Mar 30, 2025

"symbol" fallbacks the word captured into the "symbols" list and matches against any word in that list, if not word is found it will be the same as "normal", but "symbol" is used with the intention of searching the word in a list.

Example:
What you'll usually see is something like:
{ "pattern": "[%a_][%w_]*", "type": "symbol" }

captures that pattern as a symbol and searches the symbol into the "symbols" list, let's say symbol was "then", so then in that list uses the type name "keyword" as a color, if captured word isn't on that list, we will fallback to type "normal".

"symbols": [
    { "in": "keyword" },
    { "then": "keyword" },
    { "exit": "keyword" },
    { "alias": "keyword" },
    { "continue": "keyword" },
    { "getopts": "keyword" },
    { "set": "keyword" },
    { "return": "keyword" },
    { "unalias": "keyword" },
}

Updated documentation is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request syntax highlight
Projects
None yet
Development

No branches or pull requests

4 participants