• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2014 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""Node objects for the AST for a Mojo IDL file."""
6
7# Note: For convenience of testing, you probably want to define __eq__() methods
8# for all node types; it's okay to be slightly lax (e.g., not compare filename
9# and lineno).
10
11
12class BaseNode(object):
13  def __init__(self, filename=None, lineno=None):
14    self.filename = filename
15    self.lineno = lineno
16
17
18class Ordinal(BaseNode):
19  """Represents an ordinal value labeling, e.g., a struct field."""
20  def __init__(self, value, **kwargs):
21    BaseNode.__init__(self, **kwargs)
22    self.value = value
23
24  def __eq__(self, other):
25    return self.value == other.value
26