aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdgar-Alexis-Lopez-Martinez <83847738+Edgar-Alexis-Lopez-Martinez@users.noreply.github.com>2022-11-07 21:09:18 -0600
committerGitHub <noreply@github.com>2022-11-07 21:09:18 -0600
commit8580f1cdaa6d6ba579a45401bc7b07c834e0b29a (patch)
tree136c949d57764dd1c9b846175edac5d4bd531b33
parente0031d8bd9aa03515e487a9d1b71035f05fb9bd7 (diff)
downloadjavanol-8580f1cdaa6d6ba579a45401bc7b07c834e0b29a.tar.gz
javanol-8580f1cdaa6d6ba579a45401bc7b07c834e0b29a.tar.bz2
javanol-8580f1cdaa6d6ba579a45401bc7b07c834e0b29a.zip
Create automata_caracteres.py
-rw-r--r--automata_caracteres.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/automata_caracteres.py b/automata_caracteres.py
new file mode 100644
index 0000000..0173467
--- /dev/null
+++ b/automata_caracteres.py
@@ -0,0 +1,52 @@
+class automata_caracter:
+ 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:
+ if (stateN == 3):
+ state3(str[i])
+ else:
+ return 0
+
+ if (stateN == 3):
+ return 1
+ else:
+ return 0
+
+ def start(char c):
+ if (c == '\''):
+ stateN = 1
+ else:
+ stateN = -1
+
+ def state1(char c):
+ if (c != '\''):
+ stateN = 2
+ else:
+ stateN = 3
+
+ def state2(char c):
+ if (c == '\''):
+ stateN = 3
+ else:
+ stateN = -1
+
+ def state3(char c):
+ stateN = -1
+
+ bool verified(char* token):
+ if (isAccepted(token)):
+ return true
+ else:
+ return false