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

Add Nial Lexer #1803

Closed
wants to merge 28 commits into from
Closed

Add Nial Lexer #1803

wants to merge 28 commits into from

Conversation

razetime
Copy link
Contributor

@razetime razetime commented Feb 9, 2022

For use in the main Nial language website: https://nial-array-language.org/

@tancnle tancnle added the needs-review The PR needs to be reviewed label May 29, 2022
Copy link
Collaborator

@tancnle tancnle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution @razetime ❤️ The PR looks good to me overall.

It seems that the CI hasn't run on this PR yet. Could you kindly rebase this off the master branch?

We use a 2-space indentation for Ruby in this code base. Could you fix this?

lib/rouge/lexers/nial.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/nial.rb Outdated Show resolved Hide resolved
razetime and others added 21 commits June 30, 2022 08:12
We would like to run Rubocop linting against the minimum supported Ruby
version, that is 2.5. Profile and warnings will be run against the
latest version of Ruby 3.1 so we can preempt upcoming issues.
Comparing the names is much less efficient than
comparing the instance directly.

It may also change in the future: https://bugs.ruby-lang.org/issues/18576
Update the lexer for syzlang DSL to allow processing inputs with lists and
syscall arguments replaced with "...". This is useful for highlighting snippets
that are shortened for readability.

Also add tests for the new behavior.

Signed-off-by: Andrey Konovalov <[email protected]>
* initial support for lean 3

* incorporate keywords and operators from PR rouge-ruby#1019

* address comments

* add keyword::type + other keywords
…#1809)

* Fix notation of named stages in multi-stage docker builds

* Check for whitespace as well to mitigate "AS" appearing in image names

* Add multi-stage builder pattern to sample
Newly introduced "keywords": `arguments, properties, methods, import`
* add oracle plsql lexer

* add demo and sample

* tweak rules for multiline items and function/package/procedure/type creates

* add type attributes, word operators, preprocessor directives

* add rule for MERGE syntax to get keywords rather than names

* remove trailing dot option for floating point number.
restrict words after dot to functions or regular names instead of keywords

* pad visual sample with more edge cases on numbers and dot method notation.
Add comments to lexer code and pretty it up

* added PLSQL to docs/Languages.md
ensure 2 space indentation throughout
correct spelling errors in comments
change keywords to keywords_reserved and keywords_nresvd to keywords
Remove redundant comments
add cursor attributes to name::attribute list
add optional double/float modifier letters to numeric literals, also to visual test file.

* slight formatting tweak. remove extra space
This updates our Code of Conduct based on the Contributor Covenant v2.1.
* feat(lexer): Added isabelle lexer

* fix(isabelle-lexer): improved keyword handling

* feat(isabelle-lexer): improved name handling in edge cases

* feat(isabelle-lexer): improved examples

* feat(isabelle-lexer): improved examples

* feat(isabelle-lexer): added alias for pygments interop

* feat(isabelle-lexer): better code style, add to languages

* feat(isabelle-lexer): more efficient parsing

Co-authored-by: Fabian Huch <[email protected]>
…ifier, etc.) (rouge-ruby#1829)

* PHP: add missing keywords

* `empty`
* `match`
* `readonly`
* `unset`

cf. https://www.php.net/manual/en/reserved.keywords.php

* PHP: fix parsing of static properties

Previously, static property declaration with type hint like
`public static int $x;` was parsed as the following:

* Keyword (`public`)
* Keyword (`static`)
* Unknown token (`int`)
* Variable (`$x`)

`int` should be parsed as a type.

The previous parser state `:in_visibility` defines these rules:

```ruby
state :in_visibility do
  rule %r/(?=(abstract|const|function|static)\b)/i, Keyword, :pop!
  rule %r/\??#{id}/, Keyword::Type, :pop!
  # ...
end
```

Because a parser pops the current state once it find `static`,
it cannot recognize a type hint following the `static` keyword.

I split the rule into two, `static` and other. If a parser encounters
`static`, it stays in the current state and then parses a type hints.

* PHP: support `readonly` modifier

* PHP: support constructor property promotion

Since PHP 8.0, you can prepend visibility modifiers to parameters of
constructors. These parameters are "promoted" to class properties.
Since 8.1, you can specify `readonly` modifier as class properties.

cf. https://www.php.net/manual/en/language.oop5.decon.php#language.oop5.decon.constructor.promotion

* PHP: add some visual tests
…ruby#1836)

* Support more Jenkins pipeline name variations in groovy lexer

Support *.Jenkinsfile patters

* Add missing spec to groovy
@razetime
Copy link
Contributor Author

i've done the rebase. I hope this is correct.

@tancnle
Copy link
Collaborator

tancnle commented Jun 30, 2022

Thanks, @razetime. It seems that the rebase has gone awry with all the extra commits that are already in the upstream master branch. Generally, we would create a feature branch on your fork instead of using the master branch. Few options:

  1. Create a feature branch on your fork and cherry pick relevant commits. Close this PR and create a new one tracking the new feature branch. (preferred)
  2. Realign razetime/master with rouge-ruby/master (WARNING: this might blow away other changes on your local fork).
    1. Reset to earlier commit to exclude non-relevant commits
      git reset --hard bb5c7d2
    2. Fetch upstream and rebase
      git fetch upstream
      git rebase upstream/master
    3. Add the last missing commit
      git cherry-pick e09905c
    4. Force push to origin
      git push -f origin master

@razetime
Copy link
Contributor Author

Continued in #1844.

@razetime razetime closed this Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-review The PR needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.