Project

code-lexer

0.0
No release in over a year
Source code lexer configurable for any programming language that allows to tokenize and abstract a given source file
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.1.2, >= 1.1.2
 Project Readme

Code Lexer

Gem Version

This gems allows to tokenize any programming language through a simple specification file.

Install

To install the latest version, simply run the following command

gem install code-lexer

Examples

js_lexer = CodeLexer.get("javascript")
js_lexer.lex("return 0;").token_stream # → "return ¬·¬ 0 ;"

abstractor = CodeLexer::Abstractor.new.remove_spaces.abstract_identifiers
js_lexer.lex("a = b + c + b").token_stream(abstractor) # → "¬ID1¬ = ¬ID2¬ + ¬ID3¬ + ¬ID2¬"
abstractor.dictionary # → ["a", "b", "c"]