/third_party/antlr4_fast/runtime/Python3/src/antlr4/atn/ATNDeserializationOptions.py

https://github.com/alainmarcel/Surelog · Python · 24 lines · 14 code · 6 blank · 4 comment · 6 complexity · e6c1906ac77ec23997cb6aa2e00cdbb4 MD5 · raw file

  1. # Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  2. # Use of this file is governed by the BSD 3-clause license that
  3. # can be found in the LICENSE.txt file in the project root.
  4. # need a forward declaration
  5. ATNDeserializationOptions = None
  6. class ATNDeserializationOptions(object):
  7. __slots__ = ('readOnly', 'verifyATN', 'generateRuleBypassTransitions')
  8. defaultOptions = None
  9. def __init__(self, copyFrom:ATNDeserializationOptions = None):
  10. self.readOnly = False
  11. self.verifyATN = True if copyFrom is None else copyFrom.verifyATN
  12. self.generateRuleBypassTransitions = False if copyFrom is None else copyFrom.generateRuleBypassTransitions
  13. def __setattr__(self, key, value):
  14. if key!="readOnly" and self.readOnly:
  15. raise Exception("The object is read only.")
  16. super(type(self), self).__setattr__(key,value)
  17. ATNDeserializationOptions.defaultOptions = ATNDeserializationOptions()
  18. ATNDeserializationOptions.defaultOptions.readOnly = True