summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-09-16 09:37:57 +0200
committerGeorg Brandl <georg@python.org>2014-09-16 09:37:57 +0200
commit37edcfcaa1f6953ac4134fd2adcd92b80365c83e (patch)
tree567c7e623a33df5ea517f1b68382c9e6731971f2
parent110968fa96000d3167a79beeb84d1a4047771b3b (diff)
parent7d2da51ab160e2f3b91d432c87ef7286226d7c6d (diff)
downloadpygments-37edcfcaa1f6953ac4134fd2adcd92b80365c83e.tar.gz
merge with megajoule/pygments-main.
-rw-r--r--pygments/lexers/compiled.py14
-rw-r--r--pygments/lexers/functional.py2
-rw-r--r--pygments/lexers/other.py2
-rw-r--r--tests/examplefiles/99_bottles_of_beer.chpl43
4 files changed, 53 insertions, 8 deletions
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py
index 38bd901f..79790725 100644
--- a/pygments/lexers/compiled.py
+++ b/pygments/lexers/compiled.py
@@ -3920,11 +3920,11 @@ class ChapelLexer(RegexLexer):
(r'(false|nil|true)\b', Keyword.Constant),
(r'(bool|complex|imag|int|opaque|range|real|string|uint)\b',
Keyword.Type),
- (r'(atomic|begin|break|by|cobegin|coforall|continue|iter|'
+ (r'(align|atomic|begin|break|by|cobegin|coforall|continue|'
r'delete|dmapped|do|domain|else|enum|export|extern|for|forall|'
- r'if|index|inline|label|lambda|let|local|new|on|otherwise|'
- r'reduce|return|scan|select|serial|single|sparse|'
- r'subdomain|sync|then|use|when|where|while|yield|zip)\b',
+ r'if|index|inline|iter|label|lambda|let|local|new|noinit|on|'
+ r'otherwise|pragma|reduce|return|scan|select|serial|single|sparse|'
+ r'subdomain|sync|then|use|when|where|while|with|yield|zip)\b',
Keyword),
(r'(proc)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'procname'),
(r'(class|module|record|union)(\s+)', bygroups(Keyword, Text),
@@ -3946,15 +3946,17 @@ class ChapelLexer(RegexLexer):
(r'0[bB][0-1]+', Number.Bin),
# -- hex
(r'0[xX][0-9a-fA-F]+', Number.Hex),
+ # -- octal
+ (r'0[oO][0-7]+', Number.Oct),
# -- decimal
- (r'(0|[1-9][0-9]*)', Number.Integer),
+ (r'[0-9]+', Number.Integer),
# strings
(r'["\'](\\\\|\\"|[^"\'])*["\']', String),
# tokens
(r'(=|\+=|-=|\*=|/=|\*\*=|%=|&=|\|=|\^=|&&=|\|\|=|<<=|>>=|'
- r'<=>|\.\.|by|#|\.\.\.|'
+ r'<=>|<~>|\.\.|by|#|\.\.\.|'
r'&&|\|\||!|&|\||\^|~|<<|>>|'
r'==|!=|<=|>=|<|>|'
r'[+\-*/%]|\*\*)', Operator),
diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py
index 04594036..2c13dce3 100644
--- a/pygments/lexers/functional.py
+++ b/pygments/lexers/functional.py
@@ -1530,7 +1530,7 @@ class IdrisLexer(RegexLexer):
'let','proof','of','then','static','where','_','with',
'pattern', 'term', 'syntax','prefix',
'postulate','parameters','record','dsl','impossible','implicit',
- 'tactics','intros','intro','compute','refine','exaxt','trivial']
+ 'tactics','intros','intro','compute','refine','exact','trivial']
ascii = ['NUL','SOH','[SE]TX','EOT','ENQ','ACK',
'BEL','BS','HT','LF','VT','FF','CR','S[OI]','DLE',
diff --git a/pygments/lexers/other.py b/pygments/lexers/other.py
index 608e499d..0075fc07 100644
--- a/pygments/lexers/other.py
+++ b/pygments/lexers/other.py
@@ -2473,7 +2473,7 @@ class ProtoBufLexer(RegexLexer):
(r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
(r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline),
(r'\b(import|option|optional|required|repeated|default|packed|'
- r'ctype|extensions|to|max|rpc|returns)\b', Keyword),
+ r'ctype|extensions|to|max|rpc|returns|oneof)\b', Keyword),
(r'(int32|int64|uint32|uint64|sint32|sint64|'
r'fixed32|fixed64|sfixed32|sfixed64|'
r'float|double|bool|string|bytes)\b', Keyword.Type),
diff --git a/tests/examplefiles/99_bottles_of_beer.chpl b/tests/examplefiles/99_bottles_of_beer.chpl
index f73be7b1..47fcaaf6 100644
--- a/tests/examplefiles/99_bottles_of_beer.chpl
+++ b/tests/examplefiles/99_bottles_of_beer.chpl
@@ -112,7 +112,50 @@ c = nil;
c = new Oval(r=1.0, r2=2.0);
writeln("Area of oval: " + c.area());
+// This is a valid decimal integer:
+var x = 0000000000012;
+
union U {
var i: int;
var r: real;
}
+
+// chapel ranges are awesome.
+var r1 = 1..10, // 1 2 3 4 5 6 7 8 9 10
+ r2 = 10..1, // no values in this range
+ r3 = 1..10 by -1, // 10 9 8 7 6 5 4 3 2 1
+ r4 = 1..10 by 2, // 1 3 5 7 9
+ r5 = 1..10 by 2 align 0, // 2 4 6 8 10
+ r6 = 1..10 by 2 align 2, // 2 4 6 8 10
+ r7 = 1..10 # 3, // 1 2 3
+ r8 = 1..10 # -2, // 9 10
+ r9 = 1..100 # 10 by 2, // 1 3 5 7 9
+ ra = 1..100 by 2 # 10, // 1 3 5 7 9 11 13 15 17 19
+ rb = 1.. # 100 by 10; // 1 11 21 31 41 51 61 71 81 91
+
+// create a variable with default initialization
+var myVarWithoutInit: real = noinit;
+myVarWithoutInit = 1.0;
+
+// Chapel has <~> operator for read and write I/O operations.
+class IntPair {
+ var x: int;
+ var y: int;
+ proc readWriteThis(f) {
+ f <~> x <~> new ioLiteral(",") <~> y <~> new ioNewline();
+ }
+}
+var ip = new IntPair(17,2);
+write(ip);
+
+var targetDom: {1..10},
+ target: [targetDom] int;
+coforall i in targetDom with (ref target) {
+ targetDom[i] = i ** 3;
+}
+
+var wideOpen = 0o777,
+ mememe = 0o600,
+ clique_y = 0O660,
+ zeroOct = 0o0,
+ minPosOct = 0O1;