<commit_before># rFlex

rFlex is a lexical analysis library built in ruby

# Library Documentation

**Install**

> gem install rFlex

or

> git clone https://github.com/The-Duchess/rFlex
> cd rflex/rflexGem
> gem install rFlex-0.1.0.gem

**Example**

```ruby
	require 'rFlex'

	lexer = LexicalAnalyzer.new(ARGV[0].to_s, ARGV[1].to_s)

	lexertemp.lexers.each do |lexer|
		lexer.do :lex do |token, regexp, type|
			if type != "ignore"
				puts "lexeme: #{type} | value: #{token}"
				puts "-------~-----~--~------~---~-------~----~------------~---~------------~-----"
			end
		end
	end

	puts "-------~-----~--~------~---~-------~----~------------~---~------------~-----"
	puts "Tokens"
	puts "-------~-----~--~------~---~-------~----~------------~---~------------~-----"

	lexer.lex
```
**Demonstration**

[!Alttext]()

**Example Input File**

> [inputFile](https://github.com/The-Duchess/rFlex/blob/master/inputFile.txt)

int j = 12 / 3 * 5;
int i = 5;
def foo(int i, int j) {
	print (i + j);
}

**Example Regexps File**

> [regexpsFile](https://github.com/The-Duchess/rFlex/blob/master/regexpsFile.txt)

ignore     {[ \t\n]+}
assignment {^=}
terminal   {^;}
openBrace  {^\{}
closeBrace {^\}}
def        {^def}
openArg    {^\(}
closeArg   {^\)}
comma      {^,}
PRINT      {^print}<commit_msg>initial commit<commit_after># rFlex

rFlex is a lexical analysis library built in ruby

# Library Documentation

**Install**

> gem install rFlex

or

> git clone https://github.com/The-Duchess/rFlex
> cd rflex/rflexGem
> gem install rFlex-0.1.0.gem

**Example**

```ruby
	require 'rFlex'

	lexer = LexicalAnalyzer.new(ARGV[0].to_s, ARGV[1].to_s)

	lexertemp.lexers.each do |lexer|
		lexer.do :lex do |token, regexp, type|
			if type != "ignore"
				puts "lexeme: #{type} | value: #{token}"
				puts "-------~-----~--~------~---~-------~----~------------~---~------------~-----"
			end
		end
	end

	puts "-------~-----~--~------~---~-------~----~------------~---~------------~-----"
	puts "Tokens"
	puts "-------~-----~--~------~---~-------~----~------------~---~------------~-----"

	lexer.lex
```
**Demonstration**

[!Alttext](http://i.imgur.com/5EIsmxM.png)

**Example Input File**

> [inputFile](https://github.com/The-Duchess/rFlex/blob/master/inputFile.txt)

int j = 12 / 3 * 5;
int i = 5;
def foo(int i, int j) {
	print (i + j);
}

**Example Regexps File**

> [regexpsFile](https://github.com/The-Duchess/rFlex/blob/master/regexpsFile.txt)

ignore     {[ \t\n]+}
assignment {^=}
terminal   {^;}
openBrace  {^\{}
closeBrace {^\}}
def        {^def}
openArg    {^\(}
closeArg   {^\)}
comma      {^,}
PRINT      {^print}
{'fraction_non_alphanumeric': 0.3231357552581262, 'fraction_numerical': 0.00803059273422562, 'mean_word_length': 1.9196428571428572, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '34956', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1011, 'n_words': 196}