CodeRay Version History¶
This files lists all changes in the CodeRay library since the 0.8.4 release.
- CodeRay Version History
- Changes in 1.0
- Direct Streaming
- General changes
- @Tokens@
- *RENAMED*: @Tokens::AbbreviationForKind@
- @Encoders::CommentFilter@
- @Encoders::Filter@
- @Encoders::HTML@
- @Encoders::LinesOfCode@
- @Encoders::Terminal@
- @Encoders::Text@
- *RENAMED*: @Encoders::TokenKindFilter@
- @Encoders::Statistic@
- @Encoders::YAML@
- @Scanners::Scanner@
- @Scanners::CSS@
- @Scanners::Debug@
- @Scanners::Delphi@
- @Scanners::Diff@
- @Scanners::HTML@
- @Scanners::JavaScript@
- @Scanners::Java@
- @Scanners::Plaintext@
- @Scanners::Python@
- *NEW*: @Scanners::Raydebug@
- @Scanners::Ruby@
- @Scanners::Scheme@
- @Scanners::SQL@
- @Scanners::YAML@
- *NEW*: @Styles::Alpha@
- @FileType@
- @Plugin@
- Internal API changes
- Changes in 0.9.3
- @coderay@ executable
- @Scanners::JavaScript@
- @Scanners::Java@, @Scanners::JSON@
- Changes in 0.9.2
- @Encoders::Term@
- @Scanners::Debug@
- @Scanners::Groovy@
- @Scanners::PHP@
- @Scanners::YAML@
- Changes in 0.9.1
- Token classes
- @Tokens@
- @Encoders::Encoder@
- @Encoders::Tokens@
- @Encoders::Filter@
- @Encoders::TokenClassFilter@
- @Encoders::CommentFilter@
- @Encoders::LinesOfCode@
- @Encoders::JSON@
- @Encoders::Term@
- @Encoders::HTML@
- @Encoders::Text@
- @Encoders::XML@
- Scanners
- @Scanners::Scanner@
- @Scanners::Cpp@
- @Scanners::Groovy@
- @Scanners::Python@
- @Scanners::PHP@
- @Scanners::SQL@
- @Scanners::C@
- @Scanners::CSS@
- @Scanners::Delphi@
- @Scanners::Java@
- @Scanners::JavaScript@
- @Scanners::JSON@
- @Scanners::Ruby@
- @Scanners::YAML@
- @Styles::Cycnus@
- @Plugin@
- @FileType@
- @CaseIgnoringWordList@
- @ForRedCloth@
- Cleanups
Changes in 1.0¶
Direct Streaming¶
CodeRay 1.0 introduces Direct Streaming as a faster and simpler alternative to Tokens. It means that all Scanners, Encoders and Filters had to be rewritten, and that older scanners using the Tokens API are no longer compatible with this version.
The benefit of this change is more speed (benchmarks show 10% to 50% more tokens per second compared to CodeRay 0.9), a simpler API, and less code.
Changes related to the new tokens handling include:- CHANGED: The Scanners now call Encoders directly; tokens are not added to a Tokens array, but are send to the Encoder as a method call. The Tokens representation (which can be seen as a cache now) is still present, but as a special case; Tokens just encodes the given tokens into an Array for later use.
- CHANGED: The token actions (
text_token,begin_groupetc.) are now public methods ofEncoderandTokens. - REWRITE of all Scanners, Encoders, Filters, and Tokens.
- RENAMED
:openand:closeactions to:begin_groupand:end_group. - RENAMED
open_tokenandclose_tokenmethods tobegin_groupandend_group. - NEW method
#tokensallows to add several tokens to the stream.TokensandEncoders::Encoderdefine this method. - CHANGED The above name changes also affect the JSON, XML, and YAML encoders. CodeRay 1.0 output will be incompatible with earlier versions.
- REMOVED
TokenStreamand theStreamableAPI and all related features likeNotStreamableErrorare now obsolete and have been removed.
General changes¶
- IMPROVED documentation in general; additions, corrections and cleanups
- FIXED some image links in the documentation
- IMPROVED Ruby 1.9 support (_._ not in
$LOAD_PATH)
Tokens¶
- REMOVED methods
#stream?,#each_text_token. - REMOVED
#textand#text_sizemethods. Use theTextencoder instead. - REMOVED special implementation of
#eachtaking a filter parameter. UseTokenKindFilterinstead. - NEW methods
encode_with,count,begin_group,end_group,begin_line, andend_line.
RENAMED: Tokens::AbbreviationForKind¶
Renamed from ClassOfKind; the term "token class" is no longer used in CodeRay. Instead, tokens have kinds.
See #122.
- REMOVED token kinds
:attribute_name_fat,:attribute_value_fat,:operator_fat,:tag_fat,:xml_text,:open, and:close. - ADDED token kinds
:filename,:namespace, and:eyecatcher. - CHANGED: Don't raise error for unknown token kinds unless in
$CODERAY_DEBUGmode.
Encoders::CommentFilter¶
- NEW alias
:remove_comments
Encoders::Filter¶
- NEW option
tokens. - CHANGED: Now it simply delegates to the output.
- REMOVED
include_text_token?andinclude_block_token?methods.
Encoders::HTML¶
The HTML encoder was cleaned up and simplified.
- CHANGED the default style to
:alpha. - NEW: HTML 5 and CSS 3 compatible, IE incompatible.
See #215. - ADDED support for
:line_number_anchors.
See #208. - CHANGED: Use double click to toggle line numbers in table mode (as single
click jumps to an anchor.) - REMOVED support for
:line_numbers => :list. - FIXED splitting of lines for
:line_numbers => :inline, so that the line
numbers don't get colored, too. - RENAMED
Output#numerizeto#number, which is an actual English word.
Encoders::LinesOfCode¶
- CHANGED:
compileandfinishmethods are now protected.
Encoders::Terminal¶
- RENAMED from
Encoders::Term, added:termalias. - CLEANUP: Use
#setup'ssuper, don't use:proceduretoken class. - CHANGED:
#token's second parameter is no longer optional. - REMOVED colors for obsolete token kinds.
- FIXED handling of line tokens.
Encoders::Text¶
- FIXED default behavior of stripping the trailing newline.
RENAMED: Encoders::TokenKindFilter¶
Renamed from TokenClassFilter.
- NEW: Handles token groups.
See #223. - RENAMED
include_block_token?toinclude_group?.
Encoders::Statistic¶
- CHANGED: Tokens actions are counted separately.
Encoders::YAML¶
- NEW method
callfor allowing code likeCodeRay::Duo[:python => :yaml].(code)in Ruby 1.9.
Scanners::Scanner¶
- REMOVED helper method
String#to_unix. - REMOVED method
streamable?. - NEW: The
#tokenizemethod also takes an Array of Strings as source. The
code is highlighted as one and split into parts of the input lengths
after that usingTokens#split_into_parts.
Scanners::CSS¶
- NEW: Rudimentary support for the
attr,counter, andcountersfunctions.
See #224. - NEW: Rudimentary support for CSS 3 colors.
- CHANGED: Attribute selectors are highlighted as
:attribute_nameinstead of:string.
Scanners::Debug¶
- NEW: Support for line tokens (
begin_lineandend_linerepresented by[and].) - FIXED: Don't send
:errorandniltokens for buggy input any more. - FIXED: Closes unclosed tokens at the end of
scan_tokens. - IMPROVED: Highlight unknown tokens as
:error. - CHANGED: Raises an error when trying to end an invalid token group.
Scanners::Delphi¶
- FIXED: Closes open string groups.
Scanners::Diff¶
- NEW: Highlighting of code based on file names.
See ticket #52.Use the
:highlight_codeoption to turn this feature off. It's enabled
by default.This is a very original feature. It enables multi-language highlighting for
diff files, which is especially helpful for CodeRay development itself. The
updated version of the scanner test suite generated .debug.diff.html files
using this.Note: This is still experimental. Tokens spanning more than one line
may get highlighted incorrectly. CodeRay tries to keep scanner states
between the lines and changes, but the quality of the results depend on
the scanner. - NEW: Inline change highlighting, as suggested by Eric Thomas.
See ticket #227 for details.Use the
:inline_diffoption to turn this feature off. It's enabled by
default.For single-line changes (that is, a single deleted line followed by a single
inserted line), this feature surrounds the changed parts with an
:eyecatchergroup which appears in a more saturated background color.
The implementation is quite complex, and highly experimental. The problem
with multi-layer tokenizing is that the tokens have to be split into parts.
If the inline change starts, say, in the middle of a string, then additional
:end_groupand:begin_grouptokens must be inserted to keep the group
nesting intact. The extendedScanner#tokenizemethod and the new
Tokens#split_into_partsmethod take care of this. - NEW: Highlight the file name in the change headers as
:filename. - CHANGED: Highlight unknown lines as
:commentinstead of:head.
Scanners::HTML¶
- FIXED: Closes open string groups.
Scanners::JavaScript¶
- IMPROVED: Added
NaNandInfinityto list of predefined constants.
Scanners::Java¶
- NEW: Package names are highlighted as
:namespace.
See #210.
Scanners::Plaintext¶
- IMPROVED: Just returns the string without scanning (faster).
This is much faster than scanning until
/\z/in Ruby 1.8.
Scanners::Python¶
- CHANGED: Docstrings are highlighted as
:comment.
See #190.
NEW: Scanners::Raydebug¶
Copied from Scanners::Debug, highlights the token dump instead of importing it. It also reacts to the .raydebug file name suffix now.
Scanners::Ruby¶
- ADDED more predefined keywords (see http://murfy.de/ruby-constants).
- IMPROVED support for singleton method definitions.
See #147. - FIXED: Don't highlight methods with a capital letter as constants
(eg. GL.PushMatrix). - NEW: Highlight buggy floats (like .5) as
:error. - CLEANUP of documentation, names of constants and variables, state handling.
- NEW: Complicated rule for recognition of
foo=style method names. - NEW: Handles
:keep_stateoption (a bit; experimental).Actually, Ruby checks if there is
[~>=], but not=>following the name.
Scanners::Scheme¶
- CHANGED: Does use
:operatorinstead of:operator_fatnow.
Scanners::SQL¶
- IMPROVED: Extended list of keywords and functions (thanks to Joshua Galvez).
See #221.
- FIXED: Closes open string groups.
Scanners::YAML¶
- FIXED: Allow spaces before colon in mappings.
See #231.
NEW: Styles::Alpha¶
A style that uses transparent HSLA colors as defined in CSS 3.
See #199.
FileType¶
- REMOVED
FileType#shebangis a protected method now. - NEW: Recognizes
.gemspec,.rjs,.rpdfextensions andCapfileas Ruby.Thanks to the authors of the TextMate Ruby bundle!
Plugin¶
- IMPROVED:
register_forsets theplugin_id; it can now be aSymbol.
Internal API changes¶
- FIXED
Encoders::HTML#token's second parameter is no longer optional.
Changes in 0.9.3¶
- FIXED: Documentation of Tokens.
(#218)
coderay executable¶
- NEW: automatic TTY detection (uses
Termencoder) - NEW: optional 3rd parameter for the filename
- FIXED: Converted to UNIX format.
- FIXED: Warn about generated files.
- FIXED: Ensure line break after the output (especially for LoC counter).
Scanners::JavaScript¶
- FIXED: Don't keep state of XML scanner between calls for E4X literals.
Scanners::Java, Scanners::JSON¶
- FIXED: Close unfinished strings with the correct token kind.
Changes in 0.9.2¶
- NEW Basic tests and a Rakefile are now included in the Gem. [Flameeyes]
Adoctask is also included. - FIXED Use
$CODERAY_DEBUGfor debugging instead of$DEBUG. [Trans]
(#192) - REMOVED
Term::Ansicolorwas bundled under lib/, but not used. [Flameeyes]
(#205) - WORKAROUND for Ruby bug
#2745
Encoders::Term¶
- FIXED strings are closed correctly
(#138) - FIXED several token kinds had no associated color
(#139) - NEW alias
terminalNOTE: This encoder will be renamed to
Encoders::Terminalin the next release.
Scanners::Debug¶
- FIXED Don't close tokens that are not open. Send
:errortoken instead.
Scanners::Groovy¶
- FIXED token kind of closing brackets is
:operatorinstead ofnil
(#148)
Scanners::PHP¶
- FIXED allow
\operator (namespace separator)
(#209)
Scanners::YAML¶
- FIXED doesn't send debug tokens when
$DEBUGis true [Trans]
(#149)
Changes in 0.9.1¶
Token classes¶
- NEW token classes
:complex,:decorator,:imaginary
(all for Python) - REMOVED token class
:procedure
– use:functionor:methodinstead.
Tokens¶
- NEW method
#scannerStores the scanner.
- REMOVED methods
.write_token,.read_token,.escape,.unescapeThey were only used by the
Tokensencoder, which was removed also.
Encoders::Encoder¶
- REMOVED Don't require the stringio library.
- NEW public methods
#open_token,#close_token,#begin_line,#end_line
These methods are called automatically, like#text_token. - NEW proteced method
#append_encoded_token_to_output
Encoders::Tokens¶
- REMOVED – use
Tokens#dumpandTokens.load.
Encoders::Filter¶
- NEW
AFilterencoder has anotherTokensinstance as output.
Encoders::TokenClassFilter¶
- NEW
It takes 2 options,
:excludeand:include, that specify which token classes
to include or exclude for the output. They can be a single token class,
anArrayof classes, or the value:all.
Encoders::CommentFilter¶
- NEW
Removes tokens of the
:commentclass.
Encoders::LinesOfCode¶
- NEW
Counts the lines of code according to the
KINDS_NOT_LOCtoken class list
defined by the scanner. It uses the newTokenClassFilter.Alias:
:loc, as intokens.loc.
Encoders::JSON¶
- NEW
Outputs tokens in a simple JSON format.
Encoders::Term¶
- NEW (beta, by Rob Aldred)
Outputs code highlighted for a color terminal.
Encoders::HTML¶
- NEW option
:title(default value is CodeRay output)Setting this changes the title of the HTML page.
- NEW option
:highlight_lines(default:nil)Highlights the given set of line numbers.
- REMOVED option:levelIt didn't do anything. CodeRay always outputs XHTML.
Encoders::Text¶
- Uses
Encoderinterface withsuperand#text_token.
Encoders::XML¶
FIXED(#94)It didn't work at all.
Scanners¶
- NEW Mapped
:hto:c,:cplusplusand:'c++'to:cpp,
:ecma,:ecmascript,:ecma_scriptto:java_script,
:pascalto:delphi, and:plainto:plaintext.
Scanners::Scanner¶
- NEW constant
KINDS_NOT_LOCA list of all token classes not considered in LOC count.
Added appropriate values for scanners. - NEW method
#langreturns the scanner's lang, which is itsplugin_id. - FIXED automatic, safe UTF-8 detection [Ruby 1.9]
- FIXED column takes care of multibyte encodings [Ruby 1.9]
- FIXED is dumpable (
Tokensstore their scanner in an@scannervariable)
Scanners::Cpp¶
- NEW (C++)
Scanners::Groovy¶
- NEW (beta)
Scanners::Python¶
- NEW
Scanners::PHP¶
- NEW (based on Stefan Walk's work)
Scanners::SQL¶
- NEW (based on code by Josh Goebel)
Scanners::C¶
- IMPROVED added a list of
:directivetokens that were:reservedbefore - IMPROVED detection of labels
- IMPROVED allow
1Land1LLstyle literals
Scanners::CSS¶
- IMPROVED element selectors are highlighted as
:typeinstead of:keyword
Scanners::Delphi¶
- IMPROVED Don't cache tokens in CaseIgnoringWordList.
Scanners::Java¶
- IMPROVED
assertis highlighted as a:keywordnow - IMPROVED
constandgotoare highlighted as:reserved - IMPROVED
false,true, andnullare highlighted as:pre_constant - IMPROVED
threadsafeis no longer a:directive - IMPROVED
Stringis highlighted as a:pre_type - IMPROVED built-in classes ending with Error or Exception are
highlighted as a:exceptioninstead of:pre_type
Scanners::JavaScript¶
- NEW a list of
PREDEFINED_CONSTANTSto be highlighted as:pre_constant - NEW XML literals are recognized and highlighted
- NEW function name highlighting
- IMPROVED
.1is highlighted a number - FIXED strings close with the correct kind when terminated unexpectedly
Scanners::JSON¶
- IMPROVED constants (
true,false,nil) are highlighted as:value
Scanners::Ruby¶
- IMPROVED
Patterns::KEYWORDS_EXPECTING_VALUEfor more accurate
value_expecteddetection - IMPROVED handling of
\as a string delimiter - IMPROVED handling of unicode strings; automatic switching to unicode
- IMPROVED highlighting of
self.methoddefinitions - REMOVED
Patterns::FANCY_START_SAVE(obsolete) - FIXED encoding issues [Ruby 1.9]
- FIXED a problem in early Ruby 1.8.6 patch versions with
Regexp.escape
Scanners::YAML¶
- IMPROVED indentation detection
Styles::Cycnus¶
- changed a few colors (exceptions, inline strings, predefined types)
Plugin¶
- NEW method
#titleSet and get the plugin's title. Titles can be arbitrary strings.
- NEW method
#helperloads helpers from different pluginsUse this syntax:
helper 'other_plugin/helper_name'
FileType¶
- NEW
FileType[]takesPathnameinstances - NEW regonizes
.cc,.cpp,.cp,.cxx,.c++,.C,.hh,.hpp,.h++,.cuextensions (C++)Thanks to Sander Cox and the TextMate C bundle.
- NEW regonizes
.pas,.dprextensions (Delphi) - NEW regonizes
.gvy,.groovyextensions (Groovy) - NEW regonizes
.php,.php3,.php4,.php5extensions (PHP) - NEW regonizes
.py,.py3,.pywextensions (Python) - NEW regonizes
.rxmlextension (Ruby) - NEW regonizes
.sqlextension (SQL) - File types list was sorted alphabetically.
CaseIgnoringWordList¶
- FIXED (#97)
The default value is no longer ignored.
ForRedCloth¶
- FIXED for RedCloth versions 4.2.0+ (#119)
Cleanups¶
- warnings about character classes [Ruby 1.9]
- encoding issues [Ruby 1.9]
- documentation, code