aboutsummaryrefslogtreecommitdiff
path: root/automata_cadenas.py
diff options
context:
space:
mode:
authorEdgar-Alexis-Lopez-Martinez <83847738+Edgar-Alexis-Lopez-Martinez@users.noreply.github.com>2022-11-14 19:28:48 -0600
committerGitHub <noreply@github.com>2022-11-14 19:28:48 -0600
commitde272f939f2ae0266a4ee363a854558ace5a59e2 (patch)
tree2b37b82eb6133f44005dfb18e857eeae42211f80 /automata_cadenas.py
parentce60f5d0a018d9cb45d3c04cdbfd1bbfc14ae6b8 (diff)
downloadjavanol-de272f939f2ae0266a4ee363a854558ace5a59e2.tar.gz
javanol-de272f939f2ae0266a4ee363a854558ace5a59e2.tar.bz2
javanol-de272f939f2ae0266a4ee363a854558ace5a59e2.zip
Add Automatas
Automatas
Diffstat (limited to 'automata_cadenas.py')
-rw-r--r--automata_cadenas.py86
1 files changed, 43 insertions, 43 deletions
diff --git a/automata_cadenas.py b/automata_cadenas.py
index 4f8a99b..7170d4b 100644
--- a/automata_cadenas.py
+++ b/automata_cadenas.py
@@ -1,43 +1,43 @@
-class automata_cadena:
- int stateN = 0
- int isAccepted(char str[]):
-
- int len = len(str)
-
- for i in len:
- if (stateN == 0):
- start(str[i])
- else:
- if (stateN == 1):
- state1(str[i])
- else:
- if (stateN == 2):
- state2(str[i])
- else:
- return 0
-
- if (stateN == 2):
- return 1
- else:
- return 0
-
- def start(char c):
- if (c == '\"'):
- stateN = 1
- else:
- stateN = -1
-
- def state1(char c):
- if (c != '\"'):
- stateN = 1
- else:
- stateN = 2
-
- def state2(char c):
- stateN = -1
-
- bool verified(char* token):
- if (isAccepted(token)):
- return true
- else:
- return false
+class automata_cad:
+ stateN = 0
+
+ def isAccepted(self, _str):
+ i = len(_str)
+ _len = len(_str)
+
+ for i in range(len):
+ if self.stateN == 0:
+ self.start(_str[i])
+ if self.stateN == 1:
+ self.state1(_str[i])
+ if self.stateN == 2:
+ self.state2(str[i])
+ else:
+ return 0
+ if self.stateN == 2
+ return 1
+ else:
+ return 0
+
+ def start(self, c):
+ if (c == '\"'):
+ self.stateN = 1
+ else:
+ self.stateN = -1
+
+ def state1(self,c):
+ if (c != '\"'):
+ self.stateN = 1
+ else:
+ self.stateN = 2
+
+ def state2(self,c):
+ self.stateN = -1
+
+ def verified(self,token)
+ {
+ if isAccepted(token):
+ return true
+ else:
+ return false
+ } \ No newline at end of file