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

Oracle PLSQL lexer (suitable for Oracle SQL as well) #1811

Merged
merged 9 commits into from
May 2, 2022
Merged

Oracle PLSQL lexer (suitable for Oracle SQL as well) #1811

merged 9 commits into from
May 2, 2022

Conversation

lee-lindley
Copy link
Contributor

The keywords, non-reserved keywords, types and built-in functions are from the Oracle 19c manuals.
The quoted literal parsing is much better than the existing SQL lexer, especially regarding the "q'" operator. I classify the quote delimiters as operators which is a departure from most others, but they are not part of the literal, so making them the same color as the quoted string is just wrong.

I borrowed liberally from the existing SQL, Perl and Ruby lexers and folowed the Lexer Development guide.
The demo, sample and spec files are similar to others in those directories.

My blog (http://lee-lindley.github.io) is built using this lexer.

@tancnle tancnle added the needs-review The PR needs to be reviewed label Apr 17, 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 and hard work @lee-lindley ❤️ The PR looks great to me overall 👍🏼 I have added some suggestions/questions for your consideration.

  • Could we ensure 2 space indentation on the lib/rouge/lexers/psql.rb file? There seem to be some mixed 2 and 4 space indentations on the file.
  • Could we add an entry on the docs/Languages.md file for this new lexer?

Please let me know what you think 🙏🏼 .

lib/rouge/lexers/plsql.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/plsql.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/plsql.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/plsql.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/plsql.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/plsql.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/plsql.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/plsql.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/plsql.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/plsql.rb Outdated Show resolved Hide resolved
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.
@lee-lindley
Copy link
Contributor Author

Tan,
I answered each one as I was editing and pressed the "resolved" button. Because I do not see them here, I'm thinking github dumped my comments when I did that instead of saving it along with the resolution. Lesson learned.

In any case I believe I addressed all suggestions appropriately, and only did small amount of functionality tweaking. I reviewed my test files visually and everything still looks good.

@tancnle
Copy link
Collaborator

tancnle commented May 2, 2022

Thanks a lot for your prompt action @lee-lindley 🙇🏼 Looks great to me 🚀

@tancnle tancnle merged commit ee5c935 into rouge-ruby:master May 2, 2022
razetime pushed a commit to razetime/rouge that referenced this pull request Jun 30, 2022
* 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
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.

None yet

2 participants