From f06e0e319e13e0e4f1f90a7bdf634bc1ca66b182 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen <jwillemsen@remedy.nl> Date: Thu, 10 Mar 2016 14:06:48 +0100 Subject: [PATCH 1/9] Add C++11 keywords * lib/coderay/scanners/cpp.rb: --- lib/coderay/scanners/cpp.rb | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/coderay/scanners/cpp.rb b/lib/coderay/scanners/cpp.rb index e61f56f4..b0ffc068 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,14 +17,15 @@ class CPlusPlus < Scanner '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', 'nullptr' 'short', 'signed', 'unsigned', + 'wchar_t', 'string', ] # :nodoc: PREDEFINED_CONSTANTS = [ 'false', 'true', @@ -34,11 +35,12 @@ class CPlusPlus < Scanner '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 @@ class CPlusPlus < Scanner 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 @@ def scan_tokens encoder, options elsif match = scan(/\$/) encoder.text_token match, :ident - + elsif match = scan(/L?"/) encoder.begin_group :string if match[0] == ?L @@ -180,7 +182,7 @@ def scan_tokens encoder, options 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 @@ def scan_tokens encoder, options state = :initial end - + else raise_inspect 'Unknown state', encoder From 26127899acf888a1888195c8b50c4603167e2808 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen <jwillemsen@remedy.nl> Date: Fri, 11 Mar 2016 08:04:21 +0100 Subject: [PATCH 2/9] Fixed typo * FOLDERS: --- FOLDERS | 96 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/FOLDERS b/FOLDERS index f29255ae..1709d08a 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>. From 92a8e56ccd8d3aee05db9c7a821b24382528c674 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen <jwillemsen@remedy.nl> Date: Sun, 13 Mar 2016 11:47:46 +0100 Subject: [PATCH 3/9] Small changes to grouping of new C++11 keywords * lib/coderay/scanners/cpp.rb: --- lib/coderay/scanners/cpp.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/coderay/scanners/cpp.rb b/lib/coderay/scanners/cpp.rb index b0ffc068..50a25b7a 100644 --- a/lib/coderay/scanners/cpp.rb +++ b/lib/coderay/scanners/cpp.rb @@ -15,7 +15,7 @@ class CPlusPlus < Scanner 'and', 'and_eq', 'asm', 'bitand', 'bitor', 'break', 'case', 'catch', 'class', 'compl', 'const_cast', 'continue', 'default', 'delete', 'do', 'dynamic_cast', 'else', - 'enum', 'export', 'for', 'goto', 'if', 'namespace', 'new', + 'enum', 'export', 'final', 'for', 'goto', 'if', 'namespace', 'new', 'not', 'not_eq', 'or', 'or_eq', 'reinterpret_cast', 'return', 'sizeof', 'static_assert', 'static_cast', 'struct', 'switch', 'template', 'throw', 'try', 'typedef', 'typeid', 'typename', 'union', @@ -24,19 +24,19 @@ class CPlusPlus < Scanner PREDEFINED_TYPES = [ 'bool', 'char', 'char16_t', 'char32_t', 'double', 'float', - 'int', 'long', 'nullptr' 'short', 'signed', 'unsigned', + 'int', 'long', 'short', 'signed', 'unsigned', 'wchar_t', 'string', ] # :nodoc: PREDEFINED_CONSTANTS = [ 'false', 'true', - 'EOF', 'NULL', + 'EOF', 'NULL', 'nullptr' ] # :nodoc: PREDEFINED_VARIABLES = [ 'this', ] # :nodoc: DIRECTIVES = [ 'alignas', 'alignof', 'auto', 'const', 'constexpr', 'decltype', 'explicit', - 'extern', 'final', 'friend', 'inline', 'mutable', 'noexcept', 'operator', + 'extern', 'friend', 'inline', 'mutable', 'noexcept', 'operator', 'override', 'private', 'protected', 'public', 'register', 'static', 'thread_local', 'using', 'virtual', 'void', 'volatile', ] # :nodoc: From 54c94b78f18939ef8517dd2818fbb699c0fa1391 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen <jwillemsen@remedy.nl> Date: Fri, 27 May 2016 20:40:53 +0200 Subject: [PATCH 4/9] Add env setting to allow C extensions which are not allowed by default anymore by travis-ci, see https://docs.travis-ci.com/user/languages/ruby * .travis.yml: --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index f8156982..b638af12 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,6 @@ +env: + global: + - "JRUBY_OPTS=-Xcext.enabled=true" rvm: - 1.8.7 - ree From 2bce2ac91ad7994f9ead130387c8b24905853064 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen <jwillemsen@remedy.nl> Date: Fri, 27 May 2016 21:06:00 +0200 Subject: [PATCH 5/9] Allow failures with jruby 18 and 19 mode, RedCloth has a known problem, see https://jgarber.lighthouseapp.com/projects/13054/tickets/230-use-rbconfig-instead-of-obsolete-and-deprecated-config * .travis.yml: --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b638af12..5aa9e5f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,6 @@ rvm: - 2.2 - 2.3.0 - ruby-head - - jruby-18mode - - jruby-19mode - jruby-head - rbx-18mode - rbx-19mode @@ -24,5 +22,7 @@ matrix: - rvm: jruby-head - rvm: rbx-18mode - rvm: rbx-19mode + - rvm: jruby-18mode + - rvm: jruby-19mode script: "rake test" # test:scanners" sudo: false From cd3bffb1086420c02774ba905a403f8efe313f46 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen <jwillemsen@remedy.nl> Date: Fri, 27 May 2016 21:07:35 +0200 Subject: [PATCH 6/9] Shouldn't have removed the jruby lines * .travis.yml: --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 5aa9e5f9..498158f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,8 @@ rvm: - 2.3.0 - ruby-head - jruby-head + - jruby-18mode + - jruby-19mode - rbx-18mode - rbx-19mode branches: From f664af2d8e9451cd03bf1d815139514bff8956d1 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen <jwillemsen@remedy.nl> Date: Mon, 30 May 2016 08:41:30 +0200 Subject: [PATCH 7/9] Moved final from keywords to directive * lib/coderay/scanners/cpp.rb: --- lib/coderay/scanners/cpp.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/coderay/scanners/cpp.rb b/lib/coderay/scanners/cpp.rb index 50a25b7a..40aeb426 100644 --- a/lib/coderay/scanners/cpp.rb +++ b/lib/coderay/scanners/cpp.rb @@ -15,7 +15,7 @@ class CPlusPlus < Scanner 'and', 'and_eq', 'asm', 'bitand', 'bitor', 'break', 'case', 'catch', 'class', 'compl', 'const_cast', 'continue', 'default', 'delete', 'do', 'dynamic_cast', 'else', - 'enum', 'export', 'final', 'for', 'goto', 'if', 'namespace', 'new', + 'enum', 'export', 'for', 'goto', 'if', 'namespace', 'new', 'not', 'not_eq', 'or', 'or_eq', 'reinterpret_cast', 'return', 'sizeof', 'static_assert', 'static_cast', 'struct', 'switch', 'template', 'throw', 'try', 'typedef', 'typeid', 'typename', 'union', @@ -36,7 +36,7 @@ class CPlusPlus < Scanner ] # :nodoc: DIRECTIVES = [ 'alignas', 'alignof', 'auto', 'const', 'constexpr', 'decltype', 'explicit', - 'extern', 'friend', 'inline', 'mutable', 'noexcept', 'operator', + 'extern', 'final', 'friend', 'inline', 'mutable', 'noexcept', 'operator', 'override', 'private', 'protected', 'public', 'register', 'static', 'thread_local', 'using', 'virtual', 'void', 'volatile', ] # :nodoc: From 1ad3f9651b0cdc75b7efd819b112ffa1efa16538 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen <jwillemsen@remedy.nl> Date: Mon, 30 May 2016 08:42:20 +0200 Subject: [PATCH 8/9] Removed merge issue * .travis.yml: --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2c7b0f4e..ea1f1c10 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,6 @@ rvm: - jruby-19mode - jruby-head - rbx-2 ->>>>>>> de2e2acd91988e6b54f50f6c44ad85f28b68c615 branches: only: - master From 7e330abe861bcd2b23b5ea09456335a45555530b Mon Sep 17 00:00:00 2001 From: Johnny Willemsen <jwillemsen@remedy.nl> Date: Mon, 30 May 2016 08:50:49 +0200 Subject: [PATCH 9/9] Removed double line * .travis.yml: --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ea1f1c10..e04b1645 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,6 @@ rvm: - jruby-head - jruby-18mode - jruby-19mode - - jruby-head - rbx-2 branches: only: