Update CEDET from upstream.
[bpt/emacs.git] / lisp / cedet / semantic / wisent / python-wy.el
index e8229dc..d215a4b 100644 (file)
@@ -1,6 +1,6 @@
 ;;; semantic/wisent/python-wy.el --- Generated parser support file
 
-;; Copyright (C) 2002-2004, 2007, 2010-2012  Free Software Foundation, Inc.
+;; Copyright (C) 2002-2012 Free Software Foundation, Inc.
 ;; Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
 ;; 2009, 2010 Python Software Foundation; All Rights Reserved
 
 ;;; Code:
 
 (require 'semantic/lex)
+(eval-when-compile (require 'semantic/bovine))
 \f
 ;;; Prologue
 ;;
+(declare-function wisent-python-reconstitute-function-tag "semantic/wisent/python")
+(declare-function wisent-python-reconstitute-class-tag "semantic/wisent/python")
 \f
 ;;; Declarations
 ;;
      ("return" . RETURN)
      ("try" . TRY)
      ("while" . WHILE)
+     ("with" . WITH)
      ("yield" . YIELD))
    '(("yield" summary "Create a generator function")
+     ("with" summary "Start statement with an associated context object")
      ("while" summary "Start a 'while' loop")
      ("try" summary "Start of statements protected by exception handlers")
      ("return" summary "Return from a function")
      ("string"
       (STRING_LITERAL))
      ("punctuation"
+      (AT . "@")
       (BACKQUOTE . "`")
       (ASSIGN . "=")
       (COMMA . ",")
     (eval-when-compile
       (require 'semantic/wisent/comp))
     (wisent-compile-grammar
-     '((BACKSLASH NEWLINE INDENT DEDENT INDENT_BLOCK PAREN_BLOCK BRACE_BLOCK BRACK_BLOCK LPAREN RPAREN LBRACE RBRACE LBRACK RBRACK LTLTEQ GTGTEQ EXPEQ DIVDIVEQ DIVDIV LTLT GTGT EXPONENT EQ GE LE PLUSEQ MINUSEQ MULTEQ DIVEQ MODEQ AMPEQ OREQ HATEQ LTGT NE HAT LT GT AMP MULT DIV MOD PLUS MINUS PERIOD TILDE BAR COLON SEMICOLON COMMA ASSIGN BACKQUOTE STRING_LITERAL NUMBER_LITERAL NAME AND AS ASSERT BREAK CLASS CONTINUE DEF DEL ELIF ELSE EXCEPT EXEC FINALLY FOR FROM GLOBAL IF IMPORT IN IS LAMBDA NOT OR PASS PRINT RAISE RETURN TRY WHILE YIELD)
+     '((BACKSLASH NEWLINE INDENT DEDENT INDENT_BLOCK PAREN_BLOCK BRACE_BLOCK BRACK_BLOCK LPAREN RPAREN LBRACE RBRACE LBRACK RBRACK LTLTEQ GTGTEQ EXPEQ DIVDIVEQ DIVDIV LTLT GTGT EXPONENT EQ GE LE PLUSEQ MINUSEQ MULTEQ DIVEQ MODEQ AMPEQ OREQ HATEQ LTGT NE HAT LT GT AMP MULT DIV MOD PLUS MINUS PERIOD TILDE BAR COLON SEMICOLON COMMA ASSIGN BACKQUOTE AT STRING_LITERAL NUMBER_LITERAL NAME AND AS ASSERT BREAK CLASS CONTINUE DEF DEL ELIF ELSE EXCEPT EXEC FINALLY FOR FROM GLOBAL IF IMPORT IN IS LAMBDA NOT OR PASS PRINT RAISE RETURN TRY WHILE WITH YIELD)
        nil
        (goal
        ((NEWLINE))
         (wisent-raw-tag
          (semantic-tag-new-include $2 nil))))
        (dotted_as_name_list
-       ((dotted_as_name))
-       ((dotted_as_name_list COMMA dotted_as_name)))
+       ((dotted_as_name_list COMMA dotted_as_name)
+        (cons $3 $1))
+       ((dotted_as_name)
+        (list $1)))
        (star_or_import_as_name_list
        ((MULT)
         nil)
        ((while_stmt))
        ((for_stmt))
        ((try_stmt))
+       ((with_stmt))
        ((funcdef))
        ((class_declaration)))
        (if_stmt
        (nil)
        ((test zero_or_one_comma_test)
         nil))
+       (with_stmt
+       ((WITH test COLON suite)
+        (wisent-raw-tag
+         (semantic-tag-new-code $1 nil)))
+       ((WITH test with_var COLON suite)
+        (wisent-raw-tag
+         (semantic-tag-new-code $1 nil))))
+       (with_var
+       ((AS expr)
+        nil))
+       (decorator
+       ((AT dotted_name varargslist_opt NEWLINE)
+        (wisent-raw-tag
+         (semantic-tag-new-function $2 "decorator" $3))))
+       (decorators
+       ((decorator)
+        (list $1))
+       ((decorator decorators)
+        (cons $1 $2)))
        (funcdef
        ((DEF NAME function_parameter_list COLON suite)
-        (wisent-raw-tag
-         (semantic-tag-new-function $2 nil $3))))
+        (wisent-python-reconstitute-function-tag
+         (wisent-raw-tag
+          (semantic-tag-new-function $2 nil $3))
+         $5))
+       ((decorators DEF NAME function_parameter_list COLON suite)
+        (wisent-python-reconstitute-function-tag
+         (wisent-raw-tag
+          (semantic-tag-new-function $3 nil $4 :decorators $1))
+         $6)))
        (function_parameter_list
        ((PAREN_BLOCK)
         (let
          (semantic-tag-new-variable $2 nil nil))))
        (class_declaration
        ((CLASS NAME paren_class_list_opt COLON suite)
-        (wisent-raw-tag
-         (semantic-tag-new-type $2 $1 $5
-                                (cons $3 nil)))))
+        (wisent-python-reconstitute-class-tag
+         (wisent-raw-tag
+          (semantic-tag-new-type $2 $1 $5
+                                 (cons $3 nil))))))
        (paren_class_list_opt
        (nil)
        ((paren_class_list)))
 
 \f
 ;;; Analyzers
-
+;;
 (define-lex-block-type-analyzer wisent-python-wy--<block>-block-analyzer
   "block analyzer for <block> tokens."
   "\\s(\\|\\s)"
     ("]" RBRACK))
   )
 
+(define-lex-regex-type-analyzer wisent-python-wy--<symbol>-regexp-analyzer
+  "regexp analyzer for <symbol> tokens."
+  "\\(\\sw\\|\\s_\\)+"
+  nil
+  'NAME)
+
+(define-lex-regex-type-analyzer wisent-python-wy--<number>-regexp-analyzer
+  "regexp analyzer for <number> tokens."
+  semantic-lex-number-expression
+  nil
+  'NUMBER_LITERAL)
+
 (define-lex-string-type-analyzer wisent-python-wy--<punctuation>-string-analyzer
   "string analyzer for <punctuation> tokens."
   "\\(\\s.\\|\\s$\\|\\s'\\)+"
-  '((BACKQUOTE . "`")
+  '((AT . "@")
+    (BACKQUOTE . "`")
     (ASSIGN . "=")
     (COMMA . ",")
     (SEMICOLON . ";")
     (LTLTEQ . "<<="))
   'punctuation)
 
-(define-lex-regex-type-analyzer wisent-python-wy--<symbol>-regexp-analyzer
-  "regexp analyzer for <symbol> tokens."
-  "\\(\\sw\\|\\s_\\)+"
-  nil
-  'NAME)
-
-(define-lex-regex-type-analyzer wisent-python-wy--<number>-regexp-analyzer
-  "regexp analyzer for <number> tokens."
-  semantic-lex-number-expression
-  nil
-  'NUMBER_LITERAL)
-
 (define-lex-keyword-type-analyzer wisent-python-wy--<keyword>-keyword-analyzer
   "keyword analyzer for <keyword> tokens."
   "\\(\\sw\\|\\s_\\)+")