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

added ziglang support #5429

Merged
merged 8 commits into from
Jan 29, 2024
Merged

added ziglang support #5429

merged 8 commits into from
Jan 29, 2024

Conversation

bajrangCoder
Copy link
Contributor

Issue #, if available:
#5428

Description of changes:
added the zig mode and syntax higlighting and also a sample example for kitchen sink

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@marinsokol5
Copy link
Contributor

Hey, thanks a lot for the contribution. 🤗
It looks good overall, I am not too familiar with this language but I tested it a bit in kitchen sink and it looks good.

The build is currently failing with:

/home/runner/work/ace/ace/src/mode/zig_highlight_rules.js
  92:21  error  Parsing error: Invalid regular expression: /\b(?<!\.)-?[\d_]+(?!\.)\b/: Invalid group

If we can take a look into that, we can merge it afterwards.

@bajrangCoder
Copy link
Contributor Author

bajrangCoder commented Dec 18, 2023

Yeah , soon I will fix it , give some time

It looks good overall, I am not too familiar with this
language but I tested it a bit in kitchen sink and it looks
good.

Yeah I am also not a zig developer 😅, I have written this with the help of vscode-zig and one sublime one

@bajrangCoder bajrangCoder mentioned this pull request Jan 6, 2024
2 tasks
@bajrangCoder
Copy link
Contributor Author

Fixed the issue .
Result of npm run lint
Screenshot_20240107_190027

@whazor
Copy link
Contributor

whazor commented Jan 12, 2024

Hi, could you delete the commented code and delete the types/index.d.ts? For the rest it looks good to me.

@bajrangCoder
Copy link
Contributor Author

Hi, could you delete the commented code and delete the types/index.d.ts? For the rest it looks good to me.

Done ✅

@bajrangCoder
Copy link
Contributor Author

I don't have idea about why npm run cover fails . I have checked regex and they are working fine(I have tested it on kitchen sink). If anyone have idea about it then tell me, I will try my best to fix it. (@marinsokol5 , @whazor )

@whazor
Copy link
Contributor

whazor commented Jan 12, 2024

I also see these errors when opening the mode in the kitchen sink. These are the reported rules that give errors:

[
  {
    "rule": {
      "token": "text",
      "regex": "(\\\\s*)(?=\\\\s*(?:[a-zA-Z_][\\\\w.]*|@\\\\\\".+\\\\\\")?)(\\\\s*)((?:!)?)(\\\\s*)([a-zA-Z_][\\\\w.]*|@\\\\\\".+\\\\\\")",
      "onMatch": null
    },
    "groupCount": 5
  },
  {
    "rule": {
      "token": "text",
      "regex": "(\\\\s*)((?:[a-zA-Z_][\\\\w.]*|@\\\\\\".+\\\\\\")?)((?:!)?)(\\\\s*)(?:([a-zA-Z_][\\\\w.]*|@\\\\\\".+\\\\\\")\\\\b(?!\\\\s*\\\\\\\\())?)",
      "onMatch": null
    },
    "groupCount": 6
  }
]

@bajrangCoder
Copy link
Contributor Author

why this error ? due to any wrong regex or anything else?

@whazor
Copy link
Contributor

whazor commented Jan 12, 2024

The first rule (\s*)(?=\s*(?:[a-zA-Z_][\w.]*|@\".+\")?)(\s*)((?:!)?)(\s*)([a-zA-Z_][\w.]*|@\".+\") has 5 regex groups ( ... ) but you specified 6 classes:

"text",
"storage.type.zig",
"text",
"keyword.operator.zig",
"text",
"storage.type.zig"

The second rule (\s*)((?:[a-zA-Z_][\w.]*|@\".+\")?)((?:!)?)(\s*)(?:([a-zA-Z_][\w.]*|@\".+\")\b(?!\s*\\())?) has 6 regex groups, but you specified 5 classes:

"text",
"storage.type.zig",
"keyword.operator.zig",
"text",
"storage.type.zig"

The regex is a bit too complicated for me to read, so I cannot see what would be the correct order of classes.

@bajrangCoder
Copy link
Contributor Author

@whazor thanks for pointing out the problem!
Let me try to fix this ...

@bajrangCoder
Copy link
Contributor Author

@whazor I have fixed the regex issue

Copy link

codecov bot commented Jan 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c216ef4) 87.59% compared to head (d202d5d) 86.50%.
Report is 25 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5429      +/-   ##
==========================================
- Coverage   87.59%   86.50%   -1.09%     
==========================================
  Files         584      584              
  Lines       46408    42376    -4032     
  Branches     7021     7055      +34     
==========================================
- Hits        40650    36657    -3993     
+ Misses       5758     5719      -39     
Flag Coverage Δ
unittests 86.50% <100.00%> (-1.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bajrangCoder
Copy link
Contributor Author

@whazor still there is problem?

@whazor
Copy link
Contributor

whazor commented Jan 19, 2024

LGTM, I think we can ignore code coverage for language modes

@akoreman akoreman merged commit 137aac1 into ajaxorg:master Jan 29, 2024
2 of 3 checks passed
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.

4 participants