Files
cpython/Parser/Python.asdl
Georg Brandl 83bbabdc29 Merged revisions 67525-67527,67529,67548-67549,67551-67552,67555,67578,67586,67593-67594,67596,67605-67606,67609,67612,67616-67617,67632,67635,67638 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

........
  r67525 | georg.brandl | 2008-12-04 19:18:16 +0100 (Thu, 04 Dec 2008) | 2 lines

  #4527: fix "unicode or string".
........
  r67526 | georg.brandl | 2008-12-04 19:19:41 +0100 (Thu, 04 Dec 2008) | 2 lines

  #4526: fix typo.
........
  r67527 | georg.brandl | 2008-12-04 19:21:46 +0100 (Thu, 04 Dec 2008) | 2 lines

  #4521: fix getcwdu() vs getcwdb().
........
  r67529 | georg.brandl | 2008-12-04 19:28:38 +0100 (Thu, 04 Dec 2008) | 2 lines

  #4513: remove traces of zip() docstring from when it was izip().
........
  r67548 | guido.van.rossum | 2008-12-05 06:49:12 +0100 (Fri, 05 Dec 2008) | 3 lines

  Tweak verbiage and markup for relative/absolute import.  Backport candidate.
  (I guess *all* changes to this file should be backported to the 3.0 branch.)
........
  r67549 | martin.v.loewis | 2008-12-05 08:20:46 +0100 (Fri, 05 Dec 2008) | 2 lines

  Send mails to python-checkins now.
........
  r67551 | georg.brandl | 2008-12-05 08:32:56 +0100 (Fri, 05 Dec 2008) | 2 lines

  #4355: refer to urlencode in the correct module.
........
  r67552 | georg.brandl | 2008-12-05 08:45:54 +0100 (Fri, 05 Dec 2008) | 2 lines

  #4401: Re-add os.extsep.
........
  r67555 | georg.brandl | 2008-12-05 08:57:51 +0100 (Fri, 05 Dec 2008) | 2 lines

  #4427: fix arguments for "y" BuildValue type.
........
  r67578 | georg.brandl | 2008-12-05 16:12:15 +0100 (Fri, 05 Dec 2008) | 2 lines

  #4504, #4505: Update noddy examples in "Extending & Embedding".
........
  r67586 | georg.brandl | 2008-12-05 16:55:41 +0100 (Fri, 05 Dec 2008) | 2 lines

  Manually merged r67583: move __import__ doc to the bottom.
........
  r67593 | georg.brandl | 2008-12-05 19:04:41 +0100 (Fri, 05 Dec 2008) | 2 lines

  #4550: fix 2.x syntax in webservers howto.
........
  r67594 | georg.brandl | 2008-12-05 19:06:58 +0100 (Fri, 05 Dec 2008) | 2 lines

  #4549: Mention nonlocal statement in tutorial section about scoping.
........
  r67596 | georg.brandl | 2008-12-05 19:31:51 +0100 (Fri, 05 Dec 2008) | 2 lines

  Use :samp: role.
........
  r67605 | georg.brandl | 2008-12-06 09:12:11 +0100 (Sat, 06 Dec 2008) | 2 lines

  #4557: remove 'c' typecode from array docs and add a note in whatsnew.
........
  r67606 | georg.brandl | 2008-12-06 09:14:46 +0100 (Sat, 06 Dec 2008) | 2 lines

  cmp() is not really gone.
........
  r67609 | georg.brandl | 2008-12-06 15:28:56 +0100 (Sat, 06 Dec 2008) | 2 lines

  #4562: fix zip() examples.
........
  r67612 | skip.montanaro | 2008-12-06 18:25:02 +0100 (Sat, 06 Dec 2008) | 2 lines

  issue 4483 - _dbm build failures on systems with gdbm_compat lib.
........
  r67616 | benjamin.peterson | 2008-12-06 19:32:13 +0100 (Sat, 06 Dec 2008) | 1 line

  there are only four asdl builtin types in py3k
........
  r67617 | benjamin.peterson | 2008-12-06 19:33:20 +0100 (Sat, 06 Dec 2008) | 1 line

  update version number
........
  r67632 | georg.brandl | 2008-12-07 15:09:20 +0100 (Sun, 07 Dec 2008) | 2 lines

  #4576: fix ob_type access.
........
  r67635 | benjamin.peterson | 2008-12-07 15:58:03 +0100 (Sun, 07 Dec 2008) | 1 line

  document how to deal with binary standard streams
........
  r67638 | benjamin.peterson | 2008-12-07 16:07:02 +0100 (Sun, 07 Dec 2008) | 1 line

  remove extraneous 'text'
........
2008-12-07 15:52:13 +00:00

120 lines
4.2 KiB
Plaintext

-- ASDL's four builtin types are identifier, int, string, object
module Python version "$Revision$"
{
mod = Module(stmt* body)
| Interactive(stmt* body)
| Expression(expr body)
-- not really an actual node but useful in Jython's typesystem.
| Suite(stmt* body)
stmt = FunctionDef(identifier name, arguments args,
stmt* body, expr* decorator_list, expr? returns)
| ClassDef(identifier name,
expr* bases,
keyword* keywords,
expr? starargs,
expr? kwargs,
stmt* body,
expr *decorator_list)
| Return(expr? value)
| Delete(expr* targets)
| Assign(expr* targets, expr value)
| AugAssign(expr target, operator op, expr value)
-- use 'orelse' because else is a keyword in target languages
| For(expr target, expr iter, stmt* body, stmt* orelse)
| While(expr test, stmt* body, stmt* orelse)
| If(expr test, stmt* body, stmt* orelse)
| With(expr context_expr, expr? optional_vars, stmt* body)
| Raise(expr? exc, expr? cause)
| TryExcept(stmt* body, excepthandler* handlers, stmt* orelse)
| TryFinally(stmt* body, stmt* finalbody)
| Assert(expr test, expr? msg)
| Import(alias* names)
| ImportFrom(identifier module, alias* names, int? level)
| Global(identifier* names)
| Nonlocal(identifier* names)
| Expr(expr value)
| Pass | Break | Continue
-- XXX Jython will be different
-- col_offset is the byte offset in the utf8 string the parser uses
attributes (int lineno, int col_offset)
-- BoolOp() can use left & right?
expr = BoolOp(boolop op, expr* values)
| BinOp(expr left, operator op, expr right)
| UnaryOp(unaryop op, expr operand)
| Lambda(arguments args, expr body)
| IfExp(expr test, expr body, expr orelse)
| Dict(expr* keys, expr* values)
| Set(expr* elts)
| ListComp(expr elt, comprehension* generators)
| SetComp(expr elt, comprehension* generators)
| DictComp(expr key, expr value, comprehension* generators)
| GeneratorExp(expr elt, comprehension* generators)
-- the grammar constrains where yield expressions can occur
| Yield(expr? value)
-- need sequences for compare to distinguish between
-- x < 4 < 3 and (x < 4) < 3
| Compare(expr left, cmpop* ops, expr* comparators)
| Call(expr func, expr* args, keyword* keywords,
expr? starargs, expr? kwargs)
| Num(object n) -- a number as a PyObject.
| Str(string s) -- need to specify raw, unicode, etc?
| Bytes(string s)
| Ellipsis
-- other literals? bools?
-- the following expression can appear in assignment context
| Attribute(expr value, identifier attr, expr_context ctx)
| Subscript(expr value, slice slice, expr_context ctx)
| Starred(expr value, expr_context ctx)
| Name(identifier id, expr_context ctx)
| List(expr* elts, expr_context ctx)
| Tuple(expr* elts, expr_context ctx)
-- col_offset is the byte offset in the utf8 string the parser uses
attributes (int lineno, int col_offset)
expr_context = Load | Store | Del | AugLoad | AugStore | Param
slice = Slice(expr? lower, expr? upper, expr? step)
| ExtSlice(slice* dims)
| Index(expr value)
boolop = And | Or
operator = Add | Sub | Mult | Div | Mod | Pow | LShift
| RShift | BitOr | BitXor | BitAnd | FloorDiv
unaryop = Invert | Not | UAdd | USub
cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn
comprehension = (expr target, expr iter, expr* ifs)
-- not sure what to call the first argument for raise and except
excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)
attributes (int lineno, int col_offset)
arguments = (arg* args, identifier? vararg, expr? varargannotation,
arg* kwonlyargs, identifier? kwarg,
expr? kwargannotation, expr* defaults,
expr* kw_defaults)
arg = (identifier arg, expr? annotation)
-- keyword arguments supplied to call
keyword = (identifier arg, expr value)
-- import name with optional 'as' alias.
alias = (identifier name, identifier? asname)
}