|  |  | @@ -163,6 +163,11 @@ class LarkOptions(Serialize): | 
		
	
		
			
			|  |  |  | return cls(data) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | _LOAD_ALLOWED_OPTIONS = {'postlex', 'transformer', 'use_bytes', 'debug', 'g_regex_flags', 'regex', 'propagate_positions', 'keep_all_tokens', | 
		
	
		
			
			|  |  |  | 'tree_class'} | 
		
	
		
			
			|  |  |  | _LOAD_BLOCKED_OPTIONS = set(LarkOptions._defaults.keys()) - _LOAD_ALLOWED_OPTIONS | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | class Lark(Serialize): | 
		
	
		
			
			|  |  |  | """Main interface for the library. | 
		
	
		
			
			|  |  |  | 
 | 
		
	
	
		
			
				|  |  | @@ -347,7 +352,7 @@ class Lark(Serialize): | 
		
	
		
			
			|  |  |  | inst = cls.__new__(cls) | 
		
	
		
			
			|  |  |  | return inst._load(f) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | def _load(self, f, transformer=None, postlex=None): | 
		
	
		
			
			|  |  |  | def _load(self, f, **kwargs): | 
		
	
		
			
			|  |  |  | if isinstance(f, dict): | 
		
	
		
			
			|  |  |  | d = f | 
		
	
		
			
			|  |  |  | else: | 
		
	
	
		
			
				|  |  | @@ -358,10 +363,10 @@ class Lark(Serialize): | 
		
	
		
			
			|  |  |  | assert memo | 
		
	
		
			
			|  |  |  | memo = SerializeMemoizer.deserialize(memo, {'Rule': Rule, 'TerminalDef': TerminalDef}, {}) | 
		
	
		
			
			|  |  |  | options = dict(data['options']) | 
		
	
		
			
			|  |  |  | if transformer is not None: | 
		
	
		
			
			|  |  |  | options['transformer'] = transformer | 
		
	
		
			
			|  |  |  | if postlex is not None: | 
		
	
		
			
			|  |  |  | options['postlex'] = postlex | 
		
	
		
			
			|  |  |  | if _LOAD_BLOCKED_OPTIONS.intersection(kwargs.keys()): | 
		
	
		
			
			|  |  |  | raise ValueError("Some options are not allowed when loading a Parser: {}" | 
		
	
		
			
			|  |  |  | .format(_LOAD_BLOCKED_OPTIONS.intersection(kwargs.keys()))) | 
		
	
		
			
			|  |  |  | options.update(kwargs) | 
		
	
		
			
			|  |  |  | self.options = LarkOptions.deserialize(options, memo) | 
		
	
		
			
			|  |  |  | re_module = regex if self.options.regex else re | 
		
	
		
			
			|  |  |  | self.rules = [Rule.deserialize(r, memo) for r in data['rules']] | 
		
	
	
		
			
				|  |  | @@ -371,19 +376,17 @@ class Lark(Serialize): | 
		
	
		
			
			|  |  |  | data['parser'], | 
		
	
		
			
			|  |  |  | memo, | 
		
	
		
			
			|  |  |  | self._callbacks, | 
		
	
		
			
			|  |  |  | self.options.postlex, | 
		
	
		
			
			|  |  |  | self.options.transformer, | 
		
	
		
			
			|  |  |  | re_module, | 
		
	
		
			
			|  |  |  | self.options.debug | 
		
	
		
			
			|  |  |  | self.options, # Not all, but multiple attributes are used | 
		
	
		
			
			|  |  |  | ) | 
		
	
		
			
			|  |  |  | self.terminals = self.parser.lexer_conf.tokens | 
		
	
		
			
			|  |  |  | self._terminals_dict = {t.name: t for t in self.terminals} | 
		
	
		
			
			|  |  |  | return self | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | @classmethod | 
		
	
		
			
			|  |  |  | def _load_from_dict(cls, data, memo, transformer=None, postlex=None): | 
		
	
		
			
			|  |  |  | def _load_from_dict(cls, data, memo, **kwargs): | 
		
	
		
			
			|  |  |  | inst = cls.__new__(cls) | 
		
	
		
			
			|  |  |  | return inst._load({'data': data, 'memo': memo}, transformer, postlex) | 
		
	
		
			
			|  |  |  | return inst._load({'data': data, 'memo': memo}, **kwargs) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | @classmethod | 
		
	
		
			
			|  |  |  | def open(cls, grammar_filename, rel_to=None, **options): | 
		
	
	
		
			
				|  |  | 
 |