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

[raku] Distinguish between builtin types and builtin routines #720

Closed
habere-et-dispertire opened this issue Jan 5, 2023 · 6 comments · Fixed by #759
Closed

[raku] Distinguish between builtin types and builtin routines #720

habere-et-dispertire opened this issue Jan 5, 2023 · 6 comments · Fixed by #759

Comments

@habere-et-dispertire
Copy link

When highlighting the following raku:

my Int $foo = 2.sqrt;

The Int and sqrt are lumped together as NameBuiltin -- which limits the styling options. In a monochome setting, I'd enjoy for example being able to style type as underlined and other builtins as bold.

This would be a lexical enhancement which I can try and contribute but I'd need some direction on the naming for the lexical distinction I am trying to make. I guess maybe a class of NameType could work?

Thank you for a wonderful and blindingly fast highlighter!
:-)

@habere-et-dispertire
Copy link
Author

It looks like this is already handled in raku.go:

{builtinTypesPattern, NameBuiltin, nil},
{builtinRoutinesPattern, NameBuiltin, nil},

We just need to preserved the difference rather than amalgamate it.

@habere-et-dispertire habere-et-dispertire changed the title [raku] Distinguish between builtin types and other builtins [raku] Distinguish between builtin types and builtin routines Jan 5, 2023
@CIAvash
Copy link
Contributor

CIAvash commented Jan 7, 2023

There is no token for builtin routines, see Builtin Tokens.

But maybe Keyword.Type can be used for builtin types, although it's "For builtin types that can’t be used as identifiers" which doesn't apply to Raku's types.

@habere-et-dispertire
Copy link
Author

: There is no token for builtin routines, see Builtin Tokens.

I don't undertstand. What is being defined in raku.go if not just that?

builtinTypes := []string{
    `False`, `True`, `Order`, ...

builtinRoutines := []string{
    `ACCEPTS`, `abs`, `abs2rel`, ...

@CIAvash
Copy link
Contributor

CIAvash commented Jan 7, 2023

Those are definitions and separations in the code. What is important is the type of the token, such as NameBuiltin.

@habere-et-dispertire
Copy link
Author

Thank you @CIAvash 🌟🤩 !

( I tried it on the playground but I guess that's not current. What is the release schedule for chroma ? )

@habere-et-dispertire
Copy link
Author

habere-et-dispertire commented Apr 3, 2023

I've got it working in nix. It seems the bw style now has a KeywordType available:

/* KeywordType */ .chroma .kt {  }

I'd like to suggest a typographic change to the bw style:

/* KeywordType */ .chroma .kt { border-bottom: thin solid }

BTW there seems to be (a harmless?) extra semi-colon generated at the end of the bw stylesheet :

body { background-color: #ffffff;; }

Thanks @CIAvash !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants