summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2016-06-04 14:07:43 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2016-06-04 14:07:43 +0200
commit86b0bcf98a22a3933a569c7c4c0beb76d1a1b108 (patch)
tree81b852131cd87993b4f1218ebda29467a170c767
parent23e23f20e07481c5cc500b6ca726a1a9b3060725 (diff)
parent4c7bedc3bf2392444f62e90b7b8dc91d1a2effbb (diff)
downloadcoderay-86b0bcf98a22a3933a569c7c4c0beb76d1a1b108.tar.gz
Merge branch 'master' into dsl
-rw-r--r--.travis.yml11
-rw-r--r--Changes.textile4
-rw-r--r--FOLDERS96
-rw-r--r--Gemfile2
-rw-r--r--lib/coderay/scanners/cpp.rb36
5 files changed, 79 insertions, 70 deletions
diff --git a/.travis.yml b/.travis.yml
index f815698..a8080ce 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,3 +1,6 @@
+env:
+ global:
+ - "JRUBY_OPTS=-Xcext.enabled=true"
rvm:
- 1.8.7
- ree
@@ -10,16 +13,16 @@ rvm:
- jruby-18mode
- jruby-19mode
- jruby-head
- - rbx-18mode
- - rbx-19mode
+ - rbx-2
branches:
only:
- master
matrix:
allow_failures:
- rvm: ruby-head
+ - rvm: jruby-18mode
+ - rvm: jruby-19mode
- rvm: jruby-head
- - rvm: rbx-18mode
- - rvm: rbx-19mode
+ - rvm: rbx-2
script: "rake test" # test:scanners"
sudo: false
diff --git a/Changes.textile b/Changes.textile
index 10f1d6e..d77cff2 100644
--- a/Changes.textile
+++ b/Changes.textile
@@ -2,6 +2,10 @@ h1=. CodeRay Version History
p=. _This files lists all changes in the CodeRay library since the 0.9.8 release._
+h2. Changes in 1.1.2
+
+* C++ scanner: Added C++11 keywords. [#195, thanks to Johnny Willemsen]
+
h2. Changes in 1.1.1
* SQL scanner: Allow @$@ signs in SQL identifiers [#164, thanks to jasir and Ben Basson]
diff --git a/FOLDERS b/FOLDERS
index f29255a..1709d08 100644
--- a/FOLDERS
+++ b/FOLDERS
@@ -1,48 +1,48 @@
-= CodeRay - folder structure
-
-== bench - Benchmarking system
-
-All benchmarking stuff goes here.
-
-Test inputs are stored in files named <code>example.<lang></code>.
-Test outputs go to <code>bench/test.<encoder-default-file-extension></code>.
-
-Run <code>bench/bench.rb</code> to get a usage description.
-
-Run <code>rake bench</code> to perform an example benchmark.
-
-
-== bin - Scripts
-
-Executional files for CodeRay.
-
-coderay:: The CodeRay executable.
-
-== demo - Demos and functional tests
-
-Demonstrational scripts to show of CodeRay's features.
-
-Run them as functional tests with <code>rake test:demos</code>.
-
-
-== etc - Lots of stuff
-
-Some addidtional files for CodeRay, mainly graphics and Vim scripts.
-
-
-== lib - CodeRay library code
-
-This is the base directory for the CodeRay library.
-
-
-== rake_helpers - Rake helper libraries
-
-Some files to enhance Rake, including the Autumnal Rdoc template and some scripts.
-
-
-== test - Tests
-
-In the subfolder scanners/ are the scanners tests.
-Each language has its own subfolder and sub-suite.
-
-Run with <code>rake test</code>.
+= CodeRay - folder structure
+
+== bench - Benchmarking system
+
+All benchmarking stuff goes here.
+
+Test inputs are stored in files named <code>example.<lang></code>.
+Test outputs go to <code>bench/test.<encoder-default-file-extension></code>.
+
+Run <code>bench/bench.rb</code> to get a usage description.
+
+Run <code>rake bench</code> to perform an example benchmark.
+
+
+== bin - Scripts
+
+Executional files for CodeRay.
+
+coderay:: The CodeRay executable.
+
+== demo - Demos and functional tests
+
+Demonstrational scripts to show of CodeRay's features.
+
+Run them as functional tests with <code>rake test:demos</code>.
+
+
+== etc - Lots of stuff
+
+Some additional files for CodeRay, mainly graphics and Vim scripts.
+
+
+== lib - CodeRay library code
+
+This is the base directory for the CodeRay library.
+
+
+== rake_helpers - Rake helper libraries
+
+Some files to enhance Rake, including the Autumnal Rdoc template and some scripts.
+
+
+== test - Tests
+
+In the subfolder scanners/ are the scanners tests.
+Each language has its own subfolder and sub-suite.
+
+Run with <code>rake test</code>.
diff --git a/Gemfile b/Gemfile
index 6d3a176..592b79f 100644
--- a/Gemfile
+++ b/Gemfile
@@ -7,7 +7,7 @@ gemspec
# Include everything needed to run rake, tests, features, etc.
group :development do
gem "bundler"
- gem "rake"
+ gem "rake", "~> 10.5"
gem "RedCloth", RUBY_PLATFORM == 'java' ? ">= 4.2.7" : ">= 4.0.3"
gem "term-ansicolor"
gem 'tins', '~> 1.6.0'
diff --git a/lib/coderay/scanners/cpp.rb b/lib/coderay/scanners/cpp.rb
index e61f56f..40aeb42 100644
--- a/lib/coderay/scanners/cpp.rb
+++ b/lib/coderay/scanners/cpp.rb
@@ -2,14 +2,14 @@ module CodeRay
module Scanners
# Scanner for C++.
- #
+ #
# Aliases: +cplusplus+, c++
class CPlusPlus < Scanner
register_for :cpp
file_extension 'cpp'
title 'C++'
-
+
#-- http://www.cppreference.com/wiki/keywords/start
KEYWORDS = [
'and', 'and_eq', 'asm', 'bitand', 'bitor', 'break',
@@ -17,28 +17,30 @@ module Scanners
'continue', 'default', 'delete', 'do', 'dynamic_cast', 'else',
'enum', 'export', 'for', 'goto', 'if', 'namespace', 'new',
'not', 'not_eq', 'or', 'or_eq', 'reinterpret_cast', 'return',
- 'sizeof', 'static_cast', 'struct', 'switch', 'template',
- 'throw', 'try', 'typedef', 'typeid', 'typename', 'union',
+ 'sizeof', 'static_assert', 'static_cast', 'struct', 'switch',
+ 'template', 'throw', 'try', 'typedef', 'typeid', 'typename', 'union',
'while', 'xor', 'xor_eq',
] # :nodoc:
-
+
PREDEFINED_TYPES = [
- 'bool', 'char', 'double', 'float', 'int', 'long',
- 'short', 'signed', 'unsigned', 'wchar_t', 'string',
+ 'bool', 'char', 'char16_t', 'char32_t', 'double', 'float',
+ 'int', 'long', 'short', 'signed', 'unsigned',
+ 'wchar_t', 'string',
] # :nodoc:
PREDEFINED_CONSTANTS = [
'false', 'true',
- 'EOF', 'NULL',
+ 'EOF', 'NULL', 'nullptr'
] # :nodoc:
PREDEFINED_VARIABLES = [
'this',
] # :nodoc:
DIRECTIVES = [
- 'auto', 'const', 'explicit', 'extern', 'friend', 'inline', 'mutable', 'operator',
- 'private', 'protected', 'public', 'register', 'static', 'using', 'virtual', 'void',
- 'volatile',
+ 'alignas', 'alignof', 'auto', 'const', 'constexpr', 'decltype', 'explicit',
+ 'extern', 'final', 'friend', 'inline', 'mutable', 'noexcept', 'operator',
+ 'override', 'private', 'protected', 'public', 'register', 'static',
+ 'thread_local', 'using', 'virtual', 'void', 'volatile',
] # :nodoc:
-
+
IDENT_KIND = WordList.new(:ident).
add(KEYWORDS, :keyword).
add(PREDEFINED_TYPES, :predefined_type).
@@ -48,9 +50,9 @@ module Scanners
ESCAPE = / [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc:
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc:
-
+
protected
-
+
def scan_tokens encoder, options
state = :initial
@@ -107,7 +109,7 @@ module Scanners
elsif match = scan(/\$/)
encoder.text_token match, :ident
-
+
elsif match = scan(/L?"/)
encoder.begin_group :string
if match[0] == ?L
@@ -180,7 +182,7 @@ module Scanners
state = :initial
end
-
+
when :class_name_expected
if match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x)
encoder.text_token match, :class
@@ -194,7 +196,7 @@ module Scanners
state = :initial
end
-
+
else
raise_inspect 'Unknown state', encoder