Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rouge-ruby/rouge
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.19.0
Choose a base ref
...
head repository: rouge-ruby/rouge
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.20.0
Choose a head ref
  • 19 commits
  • 46 files changed
  • 9 contributors

Commits on May 30, 2020

  1. Fix erroneous brace matching rule in JavaScript lexer (#1526)

    The JavaScript lexer contains a bug in the `:statement` state. This
    state contains a rule for lexing braces but this rule prevents Rouge
    from ever leaving the `:object` state.
    
    While this does not manifest itself in visible errors in most
    situations, it has the potential to cause subtle bugs and does not fit
    the mental model a user would have trying to understand how the
    JavaScript lexer is implemented.
    
    This commit fixes the problem by removing the rule.
    pyrmont authored May 30, 2020
    Configuration menu
    Copy the full SHA
    089a1e0 View commit details
    Browse the repository at this point in the history
  2. Change the way common methods are mixed in to TypeScript-based lexers (

    …#1527)
    
    Sometimes it makes sense for a Rouge lexer to inherit methods from more
    than one class. Ruby does not have multiple class inheritance and so
    the idiomatic solution in Rouge is to extract the methods that should
    be shared into a common module that can be mixed in to the relevant
    lexers.
    
    A Ruby module can be mixed in via either calling `include` or `extend`.
    If the module is mixed in via `include`, then the methods are added as
    instance methods of the mixing class. If the module is mixed in via
    `extend`, the methods are added to the singleton class of the mixing
    class. Given the way Rouge is architected, it is more correct for the
    common module to be extended (not doing so can cause issues with
    overloading methods).
    
    This commit updates the TypeScript and TSX lexers to mix in the
    `TypescriptCommon` module by calling `extend` rather than `include`.
    pyrmont authored May 30, 2020
    Configuration menu
    Copy the full SHA
    e14b77a View commit details
    Browse the repository at this point in the history
  3. Simplify JSX and TSX lexers (#1492)

    The JSX lexer handles interpolation by running an embedded version of
    itself. This is not the manner in which other lexers handle
    interpolation and so makes maintenance difficult. It also greatly
    complicates subclassing the lexer (a practical concern because the TSX
    lexer subclasses the JSX lexer).
    
    To fix this, this commit rewrites the JSX lexer to simplify its
    structure. In particular, by specifying `:interpol` and
    `:interpol_inner` states, the need for an embedded version of the lexer
    is obviated.
    pyrmont authored May 30, 2020
    Configuration menu
    Copy the full SHA
    3b9c422 View commit details
    Browse the repository at this point in the history
  4. Permit use of trailing comma in generics in TSX lexer (#1528)

    When TypeScript is used with React, the syntax for generics (`<T>`)
    causes conflicts. The solution is to include a trailing comma (`<T,>`).
    This commit updates the TSX lexer to support this use of a trailing
    comma.
    pyrmont authored May 30, 2020
    Configuration menu
    Copy the full SHA
    c09cb89 View commit details
    Browse the repository at this point in the history

Commits on Jun 1, 2020

  1. Add new keywords to and fix bugs in OpenType feature file lexer (#1519)

    This commit updates the OpenType feature file lexer with new keywords
    and fixes to identifiers, include paths, strings and numbers. It also
    adds additional examples to the visual sample.
    punchcutter authored Jun 1, 2020
    Configuration menu
    Copy the full SHA
    37ea838 View commit details
    Browse the repository at this point in the history
  2. Add BibTeX lexer (#1360)

    This commit adds a lexer for BibTeX.
    
    Co-authored-by: Alex Liheng Wang <alw1@GS17003.SP.CS.CMU.EDU>
    Co-authored-by: Michael Camilleri <mike@inqk.net>
    3 people authored Jun 1, 2020
    Configuration menu
    Copy the full SHA
    85e1a4a View commit details
    Browse the repository at this point in the history

Commits on Jun 2, 2020

  1. Add LiveScript lexer (#650)

    This commit adds a lexer for LiveScript.
    
    Co-authored-by: Michael Camilleri <mike@inqk.net>
    lkinasiewicz and pyrmont authored Jun 2, 2020
    Configuration menu
    Copy the full SHA
    865cde6 View commit details
    Browse the repository at this point in the history
  2. Move rules from TypeScript lexer to TypeScript common module (#1530)

    The TypeScript lexer was refactored in a previous commit to move its
    memoisation methods into a module that could be mixed in by the TSX
    lexer. This is because the TSX lexer needs to inherit from both the
    TypeScript lexer and the JSX lexer but can't do that direclty because
    Ruby does not support multiple inheritance.
    
    While the memoisation methods were moved, changes to states of
    TypeScript lexer were not refactored out. This means that the TypeScript
    and TSX lexers can lex the same code differently. This commit fixes that
    problem by adopting the same approach used with the ObjectiveC common
    module: using Ruby's `Module#extended` hook.
    pyrmont authored Jun 2, 2020
    Configuration menu
    Copy the full SHA
    30fc93f View commit details
    Browse the repository at this point in the history
  3. Support nullish coalescing operator in TypeScript lexer (#1529)

    TypeScript has added support for the nullish coalescing operator `??` as
    of version 3.7. This commit adds support by prepending a rule to the
    `:root` state of lexers that extend the TypeScript common module.
    When JavaScript adopts the operator, the rule should be moved into the
    `:root` state of the JavaScript lexer and removed from the TypeScript
    common module.
    pyrmont authored Jun 2, 2020
    Configuration menu
    Copy the full SHA
    ce26fd9 View commit details
    Browse the repository at this point in the history

Commits on Jun 3, 2020

  1. Fix erroneous detection in Diff lexer (#1532)

    The `detect?` method in the Diff lexer currently returns true if the
    text contains a pair of `---` or a pair of `+++`. This causes erroneous
    matches with various types of text (e.g. certificates). This commit
    updates the method to only match alternating pairs.
    ci authored Jun 3, 2020
    Configuration menu
    Copy the full SHA
    226a15a View commit details
    Browse the repository at this point in the history
  2. Add *.cshtml file glob to HTML lexer (#1522)

    �����This commit adds the `*.cshtml` file glob to the HTML lexer.
    pyrmont authored Jun 3, 2020
    Configuration menu
    Copy the full SHA
    a5b35cf View commit details
    Browse the repository at this point in the history
  3. Add Augeas lexer (#1521)

    This commit adds a lexer for Augeas.
    
    Co-authored-by: Michael Camilleri <mike@inqk.net>
    raphink and pyrmont authored Jun 3, 2020
    2 Configuration menu
    Copy the full SHA
    3bba568 View commit details
    Browse the repository at this point in the history
  4. Add Zig lexer (#1533)

    This commit adds a lexer for Zig.
    
    Co-authored-by: Michael Camilleri <mike@inqk.net>
    timmyjose and pyrmont authored Jun 3, 2020
    Configuration menu
    Copy the full SHA
    948008b View commit details
    Browse the repository at this point in the history
  5. Support scope resolution operator in C++ lexer (#1523)

    The C++ lexer inherits the majority of its rules from the C lexer.
    While this approach reduces duplication, it can cause issues where
    assumptions that are correct in C, cause issues in C++.
    
    One such issue occurs when the scope resolution operator, `::`, is used
    in a case statement. The C lexer contains a rule that treats colons in
    a case statement as representing the 'end' of that state. While the
    assumption that a colon would not otherwise occur in a case statement
    is correct in C, that is not the case in C++. The scope resolution
    operator uses two colons and it can occur within a case statement.
    
    This commit creates a new `:case` state in the C++ lexer that uses a
    negative lookahead to avoid matching a scope resolution operator. A
    rule matching the scope resolution operator is also prepended to the
    `:statements` state.
    pyrmont authored Jun 3, 2020
    Configuration menu
    Copy the full SHA
    646e551 View commit details
    Browse the repository at this point in the history
  6. Add Velocity lexer (#1518)

    This commit adds a lexer for the Velocity templating language.
    pyrmont authored Jun 3, 2020
    Configuration menu
    Copy the full SHA
    128abf0 View commit details
    Browse the repository at this point in the history
  7. Improve support for single quotes in Haskell lexer (#1524)

    Haskell uses matching single quotes to express character literals (e.g.
    `'A'`). However, the unmatched single quote character, `'`, is also
    used for various purposes (e.g. as part of a variable name like `x'` or
    in the name of a promoted type like `'Bar`). Currently, Rouge's Haskell
    lexer permits the use of an unmatched single quote by having separate
    rules for naming and then a general rule of lower precedence for when
    the lexer encounters `'`.
    
    A better approach would be to only treat `'` as being part of a
    character literal if the lexer detects that there is a matching `'`
    within an appropriate number of characters. This commit does that and
    then creates a more general rule for matching names.
    pyrmont authored Jun 3, 2020
    Configuration menu
    Copy the full SHA
    60e4f8f View commit details
    Browse the repository at this point in the history
  8. Add HLSL lexer (#1520)

    This commit adds a lexer for HLSL.
    
    Co-authored-by: Michael Camilleri <mike@inqk.net>
    mitjmcc and pyrmont authored Jun 3, 2020
    Configuration menu
    Copy the full SHA
    45c3f41 View commit details
    Browse the repository at this point in the history

Commits on Jun 9, 2020

  1. Fix incorrect predicate usage in PowerShell lexer (#1536)

    The PowerShell lexer includes rules that use the existence of a nil
    value in a regular expression to decide whether to push new states onto
    the stack. The predicates for these rules were written incorrectly.
    This commit removes one of the predicates (which wasn't necessary) and
    uses `Object#nil?` in the other to match correctly.
    pyrmont authored Jun 9, 2020
    Configuration menu
    Copy the full SHA
    661386a View commit details
    Browse the repository at this point in the history
  2. Release v3.20.0 (#1540)

    pyrmont authored Jun 9, 2020
    Configuration menu
    Copy the full SHA
    2e21536 View commit details
    Browse the repository at this point in the history
Loading