comparison parser/Parser.d @ 176:dc9bf56b7ace

Can now use & as a unary operator and take an AddressOf
author Anders Johnsen <skabet@gmail.com>
date Thu, 24 Jul 2008 23:03:18 +0200
parents 01c2c49775ef
children 8ea749b7da91
comparison
equal deleted inserted replaced
175:c8e26556c24d 176:dc9bf56b7ace
637 return action.actOnExprStmt(exp); 637 return action.actOnExprStmt(exp);
638 638
639 case Tok.Identifier: 639 case Tok.Identifier:
640 // If it's a '*' it must be a method. Otherwise it won't give 640 // If it's a '*' it must be a method. Otherwise it won't give
641 // any sense. 641 // any sense.
642
642 if (isa(Tok.Function, 1) || 643 if (isa(Tok.Function, 1) ||
643 isa(Tok.Identifier, 1) || 644 isa(Tok.Identifier, 1) ||
644 isa(Tok.Star, 1)) 645 isa(Tok.Star, 1))
645 return action.actOnDeclStmt(parseDecl(Attribute())); 646 {
647 Attribute a;
648 return action.actOnDeclStmt(parseDecl(a));
649 }
646 650
647 if (isa(Tok.OpenBracket, 1)) 651 if (isa(Tok.OpenBracket, 1))
648 { 652 {
649 int i = 1; 653 int i = 1;
650 while (isa(Tok.OpenBracket, i) || 654 while (isa(Tok.OpenBracket, i) ||
1030 } 1034 }
1031 1035
1032 static const UnOp[] _unary = 1036 static const UnOp[] _unary =
1033 [ 1037 [
1034 {Tok.Minus, 4}, 1038 {Tok.Minus, 4},
1035 {Tok.Star, 4} 1039 {Tok.Star, 4},
1040 {Tok.And, 4}
1036 ]; 1041 ];
1037 UnOp* unary(Tok t) 1042 UnOp* unary(Tok t)
1038 { 1043 {
1039 foreach (ref op; _unary) 1044 foreach (ref op; _unary)
1040 if (op.tokenType == t) 1045 if (op.tokenType == t)