paulb@213 | 1 | #!/usr/bin/env python |
paulb@213 | 2 | |
paulb@213 | 3 | """ |
paulb@213 | 4 | Additional program AST nodes. |
paulb@213 | 5 | |
paulb@213 | 6 | Copyright (C) 2006, 2007 Paul Boddie <paul@boddie.org.uk> |
paulb@213 | 7 | |
paulb@260 | 8 | This program is free software; you can redistribute it and/or modify it under |
paulb@260 | 9 | the terms of the GNU General Public License as published by the Free Software |
paulb@260 | 10 | Foundation; either version 3 of the License, or (at your option) any later |
paulb@260 | 11 | version. |
paulb@213 | 12 | |
paulb@260 | 13 | This program is distributed in the hope that it will be useful, but WITHOUT |
paulb@260 | 14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paulb@260 | 15 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paulb@260 | 16 | details. |
paulb@213 | 17 | |
paulb@260 | 18 | You should have received a copy of the GNU General Public License along with |
paulb@260 | 19 | this program. If not, see <http://www.gnu.org/licenses/>. |
paulb@213 | 20 | """ |
paulb@213 | 21 | |
paulb@213 | 22 | class Self: |
paulb@213 | 23 | |
paulb@213 | 24 | """ |
paulb@213 | 25 | A program node encapsulating object/context information in an argument list. |
paulb@213 | 26 | This is not particularly like Attribute, Class, Instance or other such |
paulb@213 | 27 | things, since it actually appears in the program representation. |
paulb@213 | 28 | """ |
paulb@213 | 29 | |
paulb@213 | 30 | def __init__(self, attribute): |
paulb@213 | 31 | self.types = set() |
paulb@213 | 32 | self.types.add(attribute) |
paulb@213 | 33 | |
paulb@213 | 34 | class Op: |
paulb@213 | 35 | |
paulb@213 | 36 | "A replacement AST node representing an operation in a Compare construct." |
paulb@213 | 37 | |
paulb@213 | 38 | def __init__(self, name, expr): |
paulb@213 | 39 | self.name = name |
paulb@213 | 40 | self.expr = expr |
paulb@213 | 41 | |
paulb@213 | 42 | # vim: tabstop=4 expandtab shiftwidth=4 |