Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add C lexer from opal/c_lexer. (#1806)
* Add C lexer from opal/c_lexer.
- Loading branch information
1 parent
dbec19c
commit b6b8af4
Showing
7 changed files
with
69 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
begin | ||
require 'c_lexer' | ||
rescue LoadError | ||
$stderr.puts 'Failed to load CLexer, using pure Ruby lexer' | ||
end | ||
|
||
if defined? Parser::Ruby25WithCLexer | ||
class Opal::Parser::WithCLexer < Parser::Ruby25WithCLexer | ||
include Opal::Parser::DefaultConfig | ||
Opal::Parser.default_parser_class = self | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
class Opal::Parser::WithRubyLexer < Parser::Ruby25 | ||
include Opal::Parser::DefaultConfig | ||
Opal::Parser.default_parser_class = self | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters