Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 47
- Log:
A few include paths in the syntax library were still wrong, at least for
the installation on Alpha. Some spurious white space changes to files in
the 'app' tree. Fixes bug described by Ticket #37.
- Author:
- adh
- Date:
- Wed Aug 02 21:45:12 +0100 2006
- Size:
- 1011 Bytes
1 | require 'syntax/lib/syntax/common' |
2 | |
3 | module Syntax |
4 | |
5 | # A default tokenizer for handling syntaxes that are not explicitly handled |
6 | # elsewhere. It simply yields the given text as a single token. |
7 | class Default |
8 | |
9 | # Yield the given text as a single token. |
10 | def tokenize( text ) |
11 | yield Token.new( text, :normal ) |
12 | end |
13 | |
14 | end |
15 | |
16 | # A hash for registering syntax implementations. |
17 | SYNTAX = Hash.new( Default ) |
18 | |
19 | # Load the implementation of the requested syntax. If the syntax cannot be |
20 | # found, or if it cannot be loaded for whatever reason, the Default syntax |
21 | # handler will be returned. |
22 | def load( syntax ) |
23 | begin |
24 | require "syntax/lib/syntax/lang/#{syntax}" |
25 | rescue LoadError |
26 | end |
27 | SYNTAX[ syntax ].new |
28 | end |
29 | module_function :load |
30 | |
31 | # Return an array of the names of supported syntaxes. |
32 | def all |
33 | lang_dir = File.join(File.dirname(__FILE__), "syntax", "lang") |
34 | Dir["#{lang_dir}/*.rb"].map { |path| File.basename(path, ".rb") } |
35 | end |
36 | module_function :all |
37 | |
38 | end |