From 0f500f75d258b131707f4601d8010089a570c436 Mon Sep 17 00:00:00 2001 From: Lydia Duncan Date: Mon, 1 Feb 2016 09:40:03 -0800 Subject: Add 'except' and 'only' keywords to Chapel lexer and example program. Also fix example program so that it builds and runs again. --- pygments/lexers/chapel.py | 13 +++++++------ tests/examplefiles/99_bottles_of_beer.chpl | 17 +++++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/pygments/lexers/chapel.py b/pygments/lexers/chapel.py index d69c55f5..9f9894cd 100644 --- a/pygments/lexers/chapel.py +++ b/pygments/lexers/chapel.py @@ -44,12 +44,13 @@ class ChapelLexer(RegexLexer): (words(( 'align', 'atomic', 'begin', 'break', 'by', 'cobegin', 'coforall', 'continue', 'delete', 'dmapped', 'do', 'domain', 'else', 'enum', - 'export', 'extern', 'for', 'forall', 'if', 'index', 'inline', - 'iter', 'label', 'lambda', 'let', 'local', 'new', 'noinit', 'on', - 'otherwise', 'pragma', 'private', 'public', 'reduce', - 'require', 'return', 'scan', 'select', 'serial', 'single', - 'sparse', 'subdomain', 'sync', 'then', 'use', 'when', 'where', - 'while', 'with', 'yield', 'zip'), suffix=r'\b'), + 'except', 'export', 'extern', 'for', 'forall', 'if', 'index', + 'inline', 'iter', 'label', 'lambda', 'let', 'local', 'new', + 'noinit', 'on', 'only', 'otherwise', 'pragma', 'private', + 'public', 'reduce', 'require', 'return', 'scan', 'select', + 'serial', 'single', 'sparse', 'subdomain', 'sync', 'then', + 'use', 'when', 'where', 'while', 'with', 'yield', 'zip'), + suffix=r'\b'), Keyword), (r'(proc)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'procname'), (r'(class|module|record|union)(\s+)', bygroups(Keyword, Text), diff --git a/tests/examplefiles/99_bottles_of_beer.chpl b/tests/examplefiles/99_bottles_of_beer.chpl index 3629028d..cdc1e650 100644 --- a/tests/examplefiles/99_bottles_of_beer.chpl +++ b/tests/examplefiles/99_bottles_of_beer.chpl @@ -4,7 +4,7 @@ * by Brad Chamberlain and Steve Deitz * 07/13/2006 in Knoxville airport while waiting for flight home from * HPLS workshop - * compiles and runs with chpl compiler version 1.7.0 + * compiles and runs with chpl compiler version 1.12.0 * for more information, contact: chapel_info@cray.com * * @@ -71,10 +71,13 @@ proc computeAction(bottleNum) { // Modules... module M1 { var x = 10; + + var y = 13.0; } module M2 { - use M1; + use M1 except y; + use M1 only y; proc main() { writeln("M2 -> M1 -> x " + x); } @@ -148,10 +151,10 @@ class IntPair { var ip = new IntPair(17,2); write(ip); -var targetDom: {1..10}, +var targetDom = {1..10}, target: [targetDom] int; coforall i in targetDom with (ref target) { - targetDom[i] = i ** 3; + target[i] = i ** 3; } var wideOpen = 0o777, @@ -166,9 +169,11 @@ private module M3 { } private iter bar() { - + for i in 1..10 { + yield i; + } } private var x: int; -} \ No newline at end of file +} -- cgit v1.2.1