|
| 1 | +"""Definition of meta model 'StrumentaLanguageSupport'.""" |
| 2 | +from functools import partial |
| 3 | +import pyecore.ecore as Ecore |
| 4 | +from pyecore.ecore import * |
| 5 | + |
| 6 | + |
| 7 | +name = 'StrumentaLanguageSupport' |
| 8 | +nsURI = 'https://strumenta.com/kolasu/v2' |
| 9 | +nsPrefix = '' |
| 10 | + |
| 11 | +eClass = EPackage(name=name, nsURI=nsURI, nsPrefix=nsPrefix) |
| 12 | + |
| 13 | +eClassifiers = {} |
| 14 | +getEClassifier = partial(Ecore.getEClassifier, searchspace=eClassifiers) |
| 15 | +IssueType = EEnum('IssueType', literals=['LEXICAL', 'SYNTACTIC', 'SEMANTIC']) |
| 16 | + |
| 17 | +IssueSeverity = EEnum('IssueSeverity', literals=['ERROR', 'WARNING', 'INFO']) |
| 18 | + |
| 19 | + |
| 20 | +BigDecimal = EDataType('BigDecimal', instanceClassName='java.math.BigDecimal') |
| 21 | + |
| 22 | +BigInteger = EDataType('BigInteger', instanceClassName='java.math.BigInteger') |
| 23 | + |
| 24 | + |
| 25 | +class LocalDate(EObject, metaclass=MetaEClass): |
| 26 | + |
| 27 | + year = EAttribute(eType=EInt, unique=True, derived=False, changeable=True) |
| 28 | + month = EAttribute(eType=EInt, unique=True, derived=False, changeable=True) |
| 29 | + dayOfMonth = EAttribute(eType=EInt, unique=True, derived=False, changeable=True) |
| 30 | + |
| 31 | + def __init__(self, *, year=None, month=None, dayOfMonth=None): |
| 32 | + # if kwargs: |
| 33 | + # raise AttributeError('unexpected arguments: {}'.format(kwargs)) |
| 34 | + |
| 35 | + super().__init__() |
| 36 | + |
| 37 | + if year is not None: |
| 38 | + self.year = year |
| 39 | + |
| 40 | + if month is not None: |
| 41 | + self.month = month |
| 42 | + |
| 43 | + if dayOfMonth is not None: |
| 44 | + self.dayOfMonth = dayOfMonth |
| 45 | + |
| 46 | + |
| 47 | +class LocalTime(EObject, metaclass=MetaEClass): |
| 48 | + |
| 49 | + hour = EAttribute(eType=EInt, unique=True, derived=False, changeable=True) |
| 50 | + minute = EAttribute(eType=EInt, unique=True, derived=False, changeable=True) |
| 51 | + second = EAttribute(eType=EInt, unique=True, derived=False, changeable=True) |
| 52 | + nanosecond = EAttribute(eType=EInt, unique=True, derived=False, changeable=True) |
| 53 | + |
| 54 | + def __init__(self, *, hour=None, minute=None, second=None, nanosecond=None): |
| 55 | + # if kwargs: |
| 56 | + # raise AttributeError('unexpected arguments: {}'.format(kwargs)) |
| 57 | + |
| 58 | + super().__init__() |
| 59 | + |
| 60 | + if hour is not None: |
| 61 | + self.hour = hour |
| 62 | + |
| 63 | + if minute is not None: |
| 64 | + self.minute = minute |
| 65 | + |
| 66 | + if second is not None: |
| 67 | + self.second = second |
| 68 | + |
| 69 | + if nanosecond is not None: |
| 70 | + self.nanosecond = nanosecond |
| 71 | + |
| 72 | + |
| 73 | +class LocalDateTime(EObject, metaclass=MetaEClass): |
| 74 | + |
| 75 | + date = EReference(ordered=True, unique=True, containment=True, derived=False) |
| 76 | + time = EReference(ordered=True, unique=True, containment=True, derived=False) |
| 77 | + |
| 78 | + def __init__(self, *, date=None, time=None): |
| 79 | + # if kwargs: |
| 80 | + # raise AttributeError('unexpected arguments: {}'.format(kwargs)) |
| 81 | + |
| 82 | + super().__init__() |
| 83 | + |
| 84 | + if date is not None: |
| 85 | + self.date = date |
| 86 | + |
| 87 | + if time is not None: |
| 88 | + self.time = time |
| 89 | + |
| 90 | + |
| 91 | +class Point(EObject, metaclass=MetaEClass): |
| 92 | + |
| 93 | + line = EAttribute(eType=EInt, unique=True, derived=False, changeable=True) |
| 94 | + column = EAttribute(eType=EInt, unique=True, derived=False, changeable=True) |
| 95 | + |
| 96 | + def __init__(self, *, line=None, column=None): |
| 97 | + # if kwargs: |
| 98 | + # raise AttributeError('unexpected arguments: {}'.format(kwargs)) |
| 99 | + |
| 100 | + super().__init__() |
| 101 | + |
| 102 | + if line is not None: |
| 103 | + self.line = line |
| 104 | + |
| 105 | + if column is not None: |
| 106 | + self.column = column |
| 107 | + |
| 108 | + |
| 109 | +class Position(EObject, metaclass=MetaEClass): |
| 110 | + |
| 111 | + start = EReference(ordered=True, unique=True, containment=True, derived=False) |
| 112 | + end = EReference(ordered=True, unique=True, containment=True, derived=False) |
| 113 | + |
| 114 | + def __init__(self, *, start=None, end=None): |
| 115 | + # if kwargs: |
| 116 | + # raise AttributeError('unexpected arguments: {}'.format(kwargs)) |
| 117 | + |
| 118 | + super().__init__() |
| 119 | + |
| 120 | + if start is not None: |
| 121 | + self.start = start |
| 122 | + |
| 123 | + if end is not None: |
| 124 | + self.end = end |
| 125 | + |
| 126 | + |
| 127 | +@abstract |
| 128 | +class Origin(EObject, metaclass=MetaEClass): |
| 129 | + |
| 130 | + def __init__(self): |
| 131 | + # if kwargs: |
| 132 | + # raise AttributeError('unexpected arguments: {}'.format(kwargs)) |
| 133 | + |
| 134 | + super().__init__() |
| 135 | + |
| 136 | + |
| 137 | +@abstract |
| 138 | +class Destination(EObject, metaclass=MetaEClass): |
| 139 | + |
| 140 | + def __init__(self): |
| 141 | + # if kwargs: |
| 142 | + # raise AttributeError('unexpected arguments: {}'.format(kwargs)) |
| 143 | + |
| 144 | + super().__init__() |
| 145 | + |
| 146 | + |
| 147 | +class Statement(EObject, metaclass=MetaEClass): |
| 148 | + |
| 149 | + def __init__(self): |
| 150 | + # if kwargs: |
| 151 | + # raise AttributeError('unexpected arguments: {}'.format(kwargs)) |
| 152 | + |
| 153 | + super().__init__() |
| 154 | + |
| 155 | + |
| 156 | +class Expression(EObject, metaclass=MetaEClass): |
| 157 | + |
| 158 | + def __init__(self): |
| 159 | + # if kwargs: |
| 160 | + # raise AttributeError('unexpected arguments: {}'.format(kwargs)) |
| 161 | + |
| 162 | + super().__init__() |
| 163 | + |
| 164 | + |
| 165 | +class EntityDeclaration(EObject, metaclass=MetaEClass): |
| 166 | + |
| 167 | + def __init__(self): |
| 168 | + # if kwargs: |
| 169 | + # raise AttributeError('unexpected arguments: {}'.format(kwargs)) |
| 170 | + |
| 171 | + super().__init__() |
| 172 | + |
| 173 | + |
| 174 | +class Issue(EObject, metaclass=MetaEClass): |
| 175 | + |
| 176 | + type = EAttribute(eType=IssueType, unique=True, derived=False, changeable=True) |
| 177 | + message = EAttribute(eType=EString, unique=True, derived=False, changeable=True) |
| 178 | + severity = EAttribute(eType=IssueSeverity, unique=True, derived=False, changeable=True) |
| 179 | + position = EReference(ordered=True, unique=True, containment=True, derived=False) |
| 180 | + |
| 181 | + def __init__(self, *, type=None, message=None, severity=None, position=None): |
| 182 | + # if kwargs: |
| 183 | + # raise AttributeError('unexpected arguments: {}'.format(kwargs)) |
| 184 | + |
| 185 | + super().__init__() |
| 186 | + |
| 187 | + if type is not None: |
| 188 | + self.type = type |
| 189 | + |
| 190 | + if message is not None: |
| 191 | + self.message = message |
| 192 | + |
| 193 | + if severity is not None: |
| 194 | + self.severity = severity |
| 195 | + |
| 196 | + if position is not None: |
| 197 | + self.position = position |
| 198 | + |
| 199 | + |
| 200 | +class PossiblyNamed(EObject, metaclass=MetaEClass): |
| 201 | + |
| 202 | + name = EAttribute(eType=EString, unique=True, derived=False, changeable=True) |
| 203 | + |
| 204 | + def __init__(self, *, name=None): |
| 205 | + # if kwargs: |
| 206 | + # raise AttributeError('unexpected arguments: {}'.format(kwargs)) |
| 207 | + |
| 208 | + super().__init__() |
| 209 | + |
| 210 | + if name is not None: |
| 211 | + self.name = name |
| 212 | + |
| 213 | + |
| 214 | +class ReferenceByName(EObject, metaclass=MetaEClass): |
| 215 | + |
| 216 | + name = EAttribute(eType=EString, unique=True, derived=False, changeable=True) |
| 217 | + referenced = EReference(ordered=True, unique=True, containment=False, derived=False) |
| 218 | + |
| 219 | + def __init__(self, *, name=None, referenced=None): |
| 220 | + # if kwargs: |
| 221 | + # raise AttributeError('unexpected arguments: {}'.format(kwargs)) |
| 222 | + |
| 223 | + super().__init__() |
| 224 | + |
| 225 | + if name is not None: |
| 226 | + self.name = name |
| 227 | + |
| 228 | + if referenced is not None: |
| 229 | + self.referenced = referenced |
| 230 | + |
| 231 | + |
| 232 | +class Result(EObject, metaclass=MetaEClass): |
| 233 | + |
| 234 | + root = EReference(ordered=True, unique=True, containment=True, derived=False) |
| 235 | + issues = EReference(ordered=True, unique=True, containment=True, derived=False, upper=-1) |
| 236 | + |
| 237 | + def __init__(self, *, root=None, issues=None): |
| 238 | + # if kwargs: |
| 239 | + # raise AttributeError('unexpected arguments: {}'.format(kwargs)) |
| 240 | + |
| 241 | + super().__init__() |
| 242 | + |
| 243 | + if root is not None: |
| 244 | + self.root = root |
| 245 | + |
| 246 | + if issues: |
| 247 | + self.issues.extend(issues) |
| 248 | + |
| 249 | + |
| 250 | +class NodeDestination(Destination): |
| 251 | + |
| 252 | + node = EReference(ordered=True, unique=True, containment=False, derived=False) |
| 253 | + |
| 254 | + def __init__(self, *, node=None, **kwargs): |
| 255 | + |
| 256 | + super().__init__(**kwargs) |
| 257 | + |
| 258 | + if node is not None: |
| 259 | + self.node = node |
| 260 | + |
| 261 | + |
| 262 | +class TextFileDestination(Destination): |
| 263 | + |
| 264 | + position = EReference(ordered=True, unique=True, containment=True, derived=False) |
| 265 | + |
| 266 | + def __init__(self, *, position=None, **kwargs): |
| 267 | + |
| 268 | + super().__init__(**kwargs) |
| 269 | + |
| 270 | + if position is not None: |
| 271 | + self.position = position |
| 272 | + |
| 273 | + |
| 274 | +@abstract |
| 275 | +class ASTNode(Origin): |
| 276 | + |
| 277 | + position = EReference(ordered=True, unique=True, containment=True, derived=False) |
| 278 | + origin = EReference(ordered=True, unique=True, containment=False, derived=False) |
| 279 | + destination = EReference(ordered=True, unique=True, containment=True, derived=False) |
| 280 | + |
| 281 | + def __init__(self, *, position=None, origin=None, destination=None, **kwargs): |
| 282 | + |
| 283 | + super().__init__(**kwargs) |
| 284 | + |
| 285 | + if position is not None: |
| 286 | + self.position = position |
| 287 | + |
| 288 | + if origin is not None: |
| 289 | + self.origin = origin |
| 290 | + |
| 291 | + if destination is not None: |
| 292 | + self.destination = destination |
| 293 | + |
| 294 | + |
| 295 | +class Named(PossiblyNamed): |
| 296 | + |
| 297 | + name = EAttribute(eType=EString, unique=True, derived=False, changeable=True) |
| 298 | + |
| 299 | + def __init__(self, *, name=None, **kwargs): |
| 300 | + |
| 301 | + super().__init__(**kwargs) |
| 302 | + |
| 303 | + if name is not None: |
| 304 | + self.name = name |
0 commit comments