PageRenderTime 468ms CodeModel.GetById 33ms RepoModel.GetById 1ms app.codeStats 0ms

/antlr4/atn/ATNDeserializationOptions.py

https://bitbucket.org/rendoir/feup-comp
Python | 24 lines | 13 code | 7 blank | 4 comment | 6 complexity | a932beae6d5f0f35320e24fa5065164e 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. defaultOptions = None
  8. def __init__(self, copyFrom:ATNDeserializationOptions = None):
  9. self.readOnly = False
  10. self.verifyATN = True if copyFrom is None else copyFrom.verifyATN
  11. self.generateRuleBypassTransitions = False if copyFrom is None else copyFrom.generateRuleBypassTransitions
  12. def __setattr__(self, key, value):
  13. if key!="readOnly" and self.readOnly:
  14. raise Exception("The object is read only.")
  15. super(type(self), self).__setattr__(key,value)
  16. ATNDeserializationOptions.defaultOptions = ATNDeserializationOptions()
  17. ATNDeserializationOptions.defaultOptions.readOnly = True