change of name
This commit is contained in:
parent
0c88e7eff5
commit
300b266366
12
README.md
12
README.md
@ -1,17 +1,17 @@
|
|||||||
## Crystal Reader*
|
## Sapphire Reader*
|
||||||
|
|
||||||
The parser part of crystal is now a standalone gem. It parses ruby using Parslet and no other dependencies.
|
The parser part of sapphire is now a standalone gem. It parses ruby using Parslet and no other dependencies.
|
||||||
|
|
||||||
This is interesing if you want to generate executable code, like crystal, but also for other things, like code analysis.
|
This is interesing if you want to generate executable code, like sapphire, but also for other things, like code analysis.
|
||||||
|
|
||||||
Also it is very educational, as it is very readable code, and not too much of it.
|
Also it is very educational, as it is very readable code, and not too much of it.
|
||||||
|
|
||||||
*
|
*
|
||||||
It looks into it's crystal ball and all it sees is red. A red crystal . . . ruby, yes.
|
It looks into it's sapphire ball and all it sees is red. A red sapphire . . . ruby, yes.
|
||||||
|
|
||||||
### Parser
|
### Parser
|
||||||
|
|
||||||
The main parser per se is in parser/crystal , but it just pulls in all the parts.
|
The main parser per se is in parser/sapphire , but it just pulls in all the parts.
|
||||||
|
|
||||||
All the other files are ruby modules representing aspects of the parser. Most names are quite self explanitory, but here is a list:
|
All the other files are ruby modules representing aspects of the parser. Most names are quite self explanitory, but here is a list:
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ All the other files are ruby modules representing aspects of the parser. Most n
|
|||||||
|
|
||||||
The Abtract Syntax Tree (ast) layer puts the parsed code into objects, so they are nice and easy to work with.
|
The Abtract Syntax Tree (ast) layer puts the parsed code into objects, so they are nice and easy to work with.
|
||||||
|
|
||||||
The Classes don't really define any functionality, that is done in Crystal, or can be done in any code using this. Crystal just adds a compile function to each class, but a visitor pattern would do just as well.
|
The Classes don't really define any functionality, that is done in Sapphire, or can be done in any code using this. Sapphire just adds a compile function to each class, but a visitor pattern would do just as well.
|
||||||
|
|
||||||
The functionality that is in there is mainly to do with testing. Equality is defined, but also **inspect** in such a way that it's output (which you get from a failing test) can be pasted straight into the test case as the expected result.
|
The functionality that is in there is mainly to do with testing. Equality is defined, but also **inspect** in such a way that it's output (which you get from a failing test) can be pasted straight into the test case as the expected result.
|
||||||
|
|
||||||
|
8
Rakefile
8
Rakefile
@ -14,11 +14,11 @@ require 'rake'
|
|||||||
require 'jeweler'
|
require 'jeweler'
|
||||||
Jeweler::Tasks.new do |gem|
|
Jeweler::Tasks.new do |gem|
|
||||||
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
||||||
gem.name = "crystal-reader"
|
gem.name = "sapphire-reader"
|
||||||
gem.homepage = "http://github.com/crystal-vm/crystal-reader"
|
gem.homepage = "http://github.com/sapphire-vm/sapphire-reader"
|
||||||
gem.license = "GPL3"
|
gem.license = "GPL3"
|
||||||
gem.summary = %Q{Parse ruby in ruby using parslet.}
|
gem.summary = %Q{Parse ruby in ruby using parslet.}
|
||||||
gem.description = %Q{Crystal reader is part of the crystal vm. The reader reads (parses) ruby and
|
gem.description = %Q{Sapphire reader is part of the sapphire vm. The reader reads (parses) ruby and
|
||||||
creates an ast from it. There are no other dependencies than parslet, which itself has hardly any.
|
creates an ast from it. There are no other dependencies than parslet, which itself has hardly any.
|
||||||
The gem may be useful for code analysis tools or for education.
|
The gem may be useful for code analysis tools or for education.
|
||||||
Two ways to use it include adding functions to each of the AST classes, or using a visitor patter.}
|
Two ways to use it include adding functions to each of the AST classes, or using a visitor patter.}
|
||||||
@ -48,7 +48,7 @@ Rake::RDocTask.new do |rdoc|
|
|||||||
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
||||||
|
|
||||||
rdoc.rdoc_dir = 'rdoc'
|
rdoc.rdoc_dir = 'rdoc'
|
||||||
rdoc.title = "crystal-reader #{version}"
|
rdoc.title = "sapphire-reader #{version}"
|
||||||
rdoc.rdoc_files.include('README*')
|
rdoc.rdoc_files.include('README*')
|
||||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
require 'parslet'
|
require 'parslet'
|
||||||
require 'parser/crystal'
|
require 'parser/sapphire'
|
||||||
require 'parser/transform'
|
require 'parser/transform'
|
||||||
|
@ -19,7 +19,7 @@ module Parser
|
|||||||
# a maybe removes the 0 a sequence (array) to a single (hash). Thus 2 transformations are needed
|
# a maybe removes the 0 a sequence (array) to a single (hash). Thus 2 transformations are needed
|
||||||
# More work than the prettiness is worth, so only use .maybe on something that does not need capturing
|
# More work than the prettiness is worth, so only use .maybe on something that does not need capturing
|
||||||
|
|
||||||
class Crystal < Parslet::Parser
|
class Sapphire < Parslet::Parser
|
||||||
include BasicTypes
|
include BasicTypes
|
||||||
include CompoundTypes
|
include CompoundTypes
|
||||||
include Tokens
|
include Tokens
|
@ -17,7 +17,7 @@ module ParserHelper
|
|||||||
|
|
||||||
module InstanceMethods
|
module InstanceMethods
|
||||||
def setup
|
def setup
|
||||||
@parser = Parser::Crystal.new
|
@parser = Parser::Sapphire.new
|
||||||
@transform = Parser::Transform.new
|
@transform = Parser::Transform.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user