mirror of
https://github.com/PeterCamilleri/fOOrth
synced 2024-11-16 07:47:56 +01:00
The Token struct and rdoc corrections.
This commit is contained in:
parent
f73693c28b
commit
279d3879c2
5 changed files with 58 additions and 4 deletions
|
@ -4,7 +4,7 @@ static_path: []
|
|||
rdoc_include:
|
||||
- .
|
||||
charset: UTF-8
|
||||
exclude: !ruby/regexp /(?-mix:doc)|(?-mix:sire.rb)|(?-mix:.*\.4th)|(?-mix:.*\.odt)|(?-mix:.*txt)|(?-mix:.*bat)|(?-mix:.*dll)|(?-mix:.*exe)/
|
||||
exclude: !ruby/regexp /(?-mix:doc)|(?-mix:sire.rb)|(?-mix:.*\.4th)|(?-mix:.*\.odt)|(?-mix:.*bat)/
|
||||
hyperlink_all: false
|
||||
line_numbers: false
|
||||
main_page:
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# coding: utf-8
|
||||
|
||||
require_relative 'token'
|
||||
|
||||
#* parser.rb - Parse source code from a code source.
|
||||
module XfOOrth
|
||||
|
||||
|
|
21
lib/fOOrth/compiler/token.rb
Normal file
21
lib/fOOrth/compiler/token.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
# coding: utf-8
|
||||
|
||||
#* token.rb - A parsed little bit of code extracted from the source.
|
||||
module XfOOrth
|
||||
|
||||
#A structure that holds vital info extracted from the source code.
|
||||
Token = Struct.new(:code_fragment, :tag) do
|
||||
|
||||
#Is this token tagged for immediate execution?
|
||||
def immediate?
|
||||
self.tag == :immediate
|
||||
end
|
||||
|
||||
#As a string for debugging.
|
||||
def to_s
|
||||
"Token: #{self.code_fragment} / type = #{self.tag.inspect}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -29,6 +29,7 @@ RDoc::Task.new do |rdoc|
|
|||
"lib/fOOrth/compiler/file_source.rb",
|
||||
"lib/fOOrth/compiler/process.rb",
|
||||
"lib/fOOrth/compiler/parser.rb",
|
||||
"lib/fOOrth/compiler/token.rb",
|
||||
"lib/fOOrth/main.rb",
|
||||
"lib/fOOrth/monkey_patch.rb",
|
||||
"lib/fOOrth/monkey_patch/object.rb",
|
||||
|
@ -37,10 +38,13 @@ RDoc::Task.new do |rdoc|
|
|||
"lib/fOOrth/monkey_patch/complex.rb",
|
||||
"lib/fOOrth/monkey_patch/string.rb",
|
||||
"license.txt",
|
||||
"README.txt"]
|
||||
"readme.txt"]
|
||||
|
||||
#Make all access levels visible.
|
||||
rdoc.options << '--visibility' << 'private'
|
||||
|
||||
rdoc.options << '--title' << 'fOOrth Internals'
|
||||
|
||||
end
|
||||
|
||||
#Run the fOOrth test suite.
|
||||
|
|
31
readme.txt
31
readme.txt
|
@ -1,2 +1,29 @@
|
|||
This project contains the Ruby FlexArray gem. A gem used to facilitate the
|
||||
creation and processing of multi-dimensional arrays in a flexible manner.
|
||||
= The fOOrth Language gem.
|
||||
|
||||
This file contains the read-me for the fOOrth language gem. The fOOrth
|
||||
language is an experimental variant of FORTH that attempts to incorporate
|
||||
object oriented and functional programming concepts.
|
||||
|
||||
== Usage
|
||||
Adding fOOrth can be as simple as:
|
||||
|
||||
require 'fOOrth'
|
||||
XfOOrth.main
|
||||
|
||||
This will launch an interactive fOOrth session.
|
||||
<br>If, instead, a non-interactive facility is required, use:
|
||||
|
||||
require 'fOOrth'
|
||||
XfOOrth.process_string '1 2 +'
|
||||
|
||||
where the string is fOOrth code to be executed, or for a file of code, use:
|
||||
|
||||
require 'fOOrth'
|
||||
XfOOrth.process_file 'my_file.4th'
|
||||
|
||||
|
||||
== Notes
|
||||
|
||||
* Tested under ruby 1.9.3p484 (2013-11-22) [i386-mingw32]
|
||||
* No notable dependencies. minitest, rake, rdoc and reek are used in development.
|
||||
* I have used rdoc 4.0.1 here. Later versions of rdoc look like crap!
|
||||
|
|
Loading…
Reference in a new issue