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

comment plugin: add comment syntax for Factor #3564

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AndydeCleyre
Copy link

Simply adds the comment symbol used by Factor, !, to the comment plugin.

@Andriamanitra
Copy link
Contributor

Micro currently does not recognize "factor" file type so this change alone does not do much. It would be good to add a syntax file as well to detect the file type.

@AndydeCleyre
Copy link
Author

I'm using one locally but it's not polished enough to contribute:

filetype: factor

detect:
    filename: "\\.factor(-rc)?$"

rules:
    - comment: "!.*$"
    - comment: "/\\*.*\\*/"
    - symbol.operator: "\\[|\\]|\\(|\\)|\\{|\\}|;|--|:|>>"  # Added curly braces and colon
    - constant.string: "\".*\""
    - constant: "\\b(t|f)\\b"
    - type: "\\b[A-Z][A-Z0-9_-]*:\\b"  # All-caps words ending with colon
    - type: "\\b(USING:|IN:|FROM:|QUALIFIED:|ALIAS:|RENAME:)\\b"
    - statement: "\\b(2nip|2dup|2drop|2bi|2tri|2curry|2dip|2keep|2over|3bi|3curry|3dip|3drop|3dup|3keep|3tri|4dip|4drop|4dup|4keep|deep-clone|keep-under|bi-curry|clone|\\?execute|\\?if|and|assert|assert=|assert\\?|bi-curry|bi@|bi\\*|boolean|call|clear|compose|curry|die|dip|do|drop|dup|execute|if|keep|loop|new|nip|not|null|object|or|over|pick|rot|swap|throw|unless|until|when|while|with|wrapper)\\b"
    - identifier: "^:\\s+[\\w-]+\\b"
    - constant.number: "\\b[0-9]+\\b"

If anyone else wants to have a go, for reference here are some existing regex-based syntax highlighting definitions for Factor:

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 this pull request may close these issues.

2 participants