
Security News
Rspack Introduces Rslint, a TypeScript-First Linter Written in Go
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
= Syntax
A syntax highlighting a library for Ruby.
{}[https://travis-ci.org/dblock/syntax]
This fork is maintained and version 1.1.0 has been published from it. However, there's currently none or not much new development going on here and the original author, @jamis[https://github.com/jamis], recommends using CodeRay[http://coderay.rubychan.de], over this library.
== About
This is a simple syntax highlighting library for Ruby. It is a naive syntax analysis tool, meaning that it does not "understand" the syntaxes of the languages it processes, but merely does some semi-intelligent pattern matching.
== Usage
There are primarily two uses for the Syntax library:
=== Highlighting a supported syntax
require 'syntax/convertors/html'
convertor = Syntax::Convertors::HTML.for_syntax "ruby" puts convertor.convert( File.read( "file.rb" ) )
The above snippet will emit HTML, using spans and CSS to indicate the different highlight "groups". (Sample CSS files are included in the "data" directory.)
=== Tokenize text
require 'syntax'
tokenizer = Syntax.load "ruby" tokenizer.tokenize( File.read( "file.rb" ) ) do |token| puts "group(#{token.group}, #{token.instruction}) lexeme(#{token})" end
Tokenizing is straightforward process. Each time a new token is discovered by the tokenizer, it is yielded to the given block.
FAQs
Unknown package
We found that syntax demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.