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 Smithy Lexer (#1878) #1879

Merged
merged 3 commits into from
Aug 8, 2021
Merged

Added Smithy Lexer (#1878) #1879

merged 3 commits into from
Aug 8, 2021

Conversation

immanuelqrw
Copy link
Contributor

@immanuelqrw immanuelqrw commented Aug 5, 2021

  • Added Smithy Lexer
  • Added Smithy Lexer author
  • Documented Smithy as a supported language
  • Added Smithy test file and output

* Added Smithy Lexer
* Added Smithy Lexer auhtor
* Documented Smithy as a supported language
* Added Smithy test file and output
pygments/lexers/smithy.py Outdated Show resolved Hide resolved
pygments/lexers/smithy.py Show resolved Hide resolved
pygments/lexers/smithy.py Outdated Show resolved Hide resolved
Comment on lines 38 to 41
(r'^(use|byte|short|integer|long|float|'
r'document|double|bigInteger|bigDecimal|boolean|blob|string|timestamp)(\s+' + identifier + r')\b',
bygroups(Keyword.Declaration, Name.Class)),
(r'^(apply|list|map|set|structure|union|resource|operation|service|trait)(\s+' + identifier + r')',
Copy link
Collaborator

Choose a reason for hiding this comment

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

We have a words() function to efficiently match lists of words, can you please change those two to use that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah cool, added.

* Added Standard file heading with copyright and license
* Used `words` method for optimization, instead of bare regex
* Specified whitespace punctuation in root
* Updated aliases to only contain lowercase names to pass `test_basic_api` tests
* Updated regexes lightly to fit regexlint rules (removing duplicate characters in group `-`)
* Fixed regexes with errors in regexlint rules (Escaping brackets, gaps in capture groups)
@Anteru
Copy link
Collaborator

Anteru commented Aug 5, 2021

Thanks for the timely updates!

@Anteru Anteru self-assigned this Aug 5, 2021
@Anteru Anteru added the A-lexing area: changes to individual lexers label Aug 5, 2021
@Anteru Anteru added this to the 2.10 milestone Aug 5, 2021
* Ran mapping to update after changing aliases in previous commit
@immanuelqrw
Copy link
Contributor Author

Forgot to re-run _mapping.py after the last changes. Ran that and committed the updated aliases and mappings.

@immanuelqrw
Copy link
Contributor Author

Not sure why pypy3 · ubuntu-latest test failed.

test_happy_javascript_fragment failed, but no changes were made that should have affected that.

Error:

  >       assert time.time() - start_time < MAX_HL_TIME, \
              'The HTML lexer might have an expensive happy-path script case'
  E       AssertionError: The HTML lexer might have an expensive happy-path script case
  E       assert (1628191328.1567895 - 1628191316.165653) < 10
  E        +  where 1628191328.1567895 = <built-in function time>()
  E        +    where <built-in function time> = time.time
  E        +    where <built-in function time> = time.time
  
  /home/runner/work/pygments/pygments/tests/test_html_lexer.py:31: AssertionError

Seems like a randomly slow test event?
Wasn't sure if there was something I could do to look into this, or if it's just a flaky test that needs to be re-run.

@Anteru
Copy link
Collaborator

Anteru commented Aug 8, 2021

Yes, that's a slow test failing once in a while. Don't worry :)

@Anteru Anteru merged commit e2352ff into pygments:master Aug 8, 2021
@Anteru Anteru added the changelog-update Items which need to get mentioned in the changelog label Aug 8, 2021
@Anteru
Copy link
Collaborator

Anteru commented Aug 8, 2021

Merged, thanks for your contribution!

@Anteru Anteru removed the changelog-update Items which need to get mentioned in the changelog label Aug 8, 2021
@Anteru Anteru linked an issue Aug 8, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lexing area: changes to individual lexers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add lexer for Smithy
2 participants