Server IP : 103.119.228.120 / Your IP : 3.147.68.201 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /lib/mysqlsh/lib/python3.9/site-packages/antlr4/dfa/ |
Upload File : |
# # Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. # Use of this file is governed by the BSD 3-clause license that # can be found in the LICENSE.txt file in the project root. from antlr4.atn.ATNState import StarLoopEntryState from antlr4.atn.ATNConfigSet import ATNConfigSet from antlr4.atn.ATNState import DecisionState from antlr4.dfa.DFAState import DFAState from antlr4.error.Errors import IllegalStateException class DFA(object): __slots__ = ('atnStartState', 'decision', '_states', 's0', 'precedenceDfa') def __init__(self, atnStartState:DecisionState, decision:int=0): # From which ATN state did we create this DFA? self.atnStartState = atnStartState self.decision = decision # A set of all DFA states. Use {@link Map} so we can get old state back # ({@link Set} only allows you to see if it's there). self._states = dict() self.s0 = None # {@code true} if this DFA is for a precedence decision; otherwise, # {@code false}. This is the backing field for {@link #isPrecedenceDfa}, # {@link #setPrecedenceDfa}. self.precedenceDfa = False if isinstance(atnStartState, StarLoopEntryState): if atnStartState.isPrecedenceDecision: self.precedenceDfa = True precedenceState = DFAState(configs=ATNConfigSet()) precedenceState.edges = [] precedenceState.isAcceptState = False precedenceState.requiresFullContext = False self.s0 = precedenceState # Get the start state for a specific precedence value. # # @param precedence The current precedence. # @return The start state corresponding to the specified precedence, or # {@code null} if no start state exists for the specified precedence. # # @throws IllegalStateException if this is not a precedence DFA. # @see #isPrecedenceDfa() def getPrecedenceStartState(self, precedence:int): if not self.precedenceDfa: raise IllegalStateException("Only precedence DFAs may contain a precedence start state.") # s0.edges is never null for a precedence DFA if precedence < 0 or precedence >= len(self.s0.edges): return None return self.s0.edges[precedence] # Set the start state for a specific precedence value. # # @param precedence The current precedence. # @param startState The start state corresponding to the specified # precedence. # # @throws IllegalStateException if this is not a precedence DFA. # @see #isPrecedenceDfa() # def setPrecedenceStartState(self, precedence:int, startState:DFAState): if not self.precedenceDfa: raise IllegalStateException("Only precedence DFAs may contain a precedence start state.") if precedence < 0: return # synchronization on s0 here is ok. when the DFA is turned into a # precedence DFA, s0 will be initialized once and not updated again # s0.edges is never null for a precedence DFA if precedence >= len(self.s0.edges): ext = [None] * (precedence + 1 - len(self.s0.edges)) self.s0.edges.extend(ext) self.s0.edges[precedence] = startState # # Sets whether this is a precedence DFA. If the specified value differs # from the current DFA configuration, the following actions are taken; # otherwise no changes are made to the current DFA. # # <ul> # <li>The {@link #states} map is cleared</li> # <li>If {@code precedenceDfa} is {@code false}, the initial state # {@link #s0} is set to {@code null}; otherwise, it is initialized to a new # {@link DFAState} with an empty outgoing {@link DFAState#edges} array to # store the start states for individual precedence values.</li> # <li>The {@link #precedenceDfa} field is updated</li> # </ul> # # @param precedenceDfa {@code true} if this is a precedence DFA; otherwise, # {@code false} def setPrecedenceDfa(self, precedenceDfa:bool): if self.precedenceDfa != precedenceDfa: self._states = dict() if precedenceDfa: precedenceState = DFAState(configs=ATNConfigSet()) precedenceState.edges = [] precedenceState.isAcceptState = False precedenceState.requiresFullContext = False self.s0 = precedenceState else: self.s0 = None self.precedenceDfa = precedenceDfa @property def states(self): return self._states # Return a list of all states in this DFA, ordered by state number. def sortedStates(self): return sorted(self._states.keys(), key=lambda state: state.stateNumber) def __str__(self): return self.toString(None) def toString(self, literalNames:list=None, symbolicNames:list=None): if self.s0 is None: return "" from antlr4.dfa.DFASerializer import DFASerializer serializer = DFASerializer(self,literalNames,symbolicNames) return str(serializer) def toLexerString(self): if self.s0 is None: return "" from antlr4.dfa.DFASerializer import LexerDFASerializer serializer = LexerDFASerializer(self) return str(serializer)