Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # py2cpp.py # ZZZ
- zzz = '''
- '''
- zzz = [z.split()[0] for z in zzz.strip().splitlines()]
- zzz = '\n'.join(zzz)
- zzz = zzz + '''
- '''.strip()
- escapes = '''
- \n
- \r
- \t
- \v
- \b
- \f
- \a
- \'
- \"
- \?
- \\
- '''
- inPrecedence = '''
- ()
- * / %
- + -
- < > <= >=
- == !=
- &&
- ||
- '''
- def p():
- t = zzz
- for z in [',', ';', '\t', ' ']:
- while z in t:
- t = t.replace(z,' ')
- return t
- def p2():
- p = []
- ttt = zzz
- for z in range(10):
- ttt = ttt.replace(str(z),'\n')
- ttt = ttt.splitlines()
- for t in ttt:
- for z in ['keyword','::',';','()']:
- if z in t:
- if 40 > len(t) > 3:
- t = t.strip()
- if t.endswith(','):
- t = t[:-1]
- p.append(t)
- break
- return '\n'.join(p).replace(';','')
- zzz = p()
- ttt = zzz.replace(' ','\n')
- zzz = '''
- *cmp
- #include
- #include <algorithm>
- #include <array>
- #include <assert.h>
- #include <atomic>
- #include <bitset>
- #include <cassert>
- #include <ccomplex>
- #include <cctype>
- #include <cerrno>
- #include <cfenv>
- #include <cfloat>
- #include <cgicc/CgiDefs.h>
- #include <cgicc/Cgicc.h>
- #include <cgicc/HTMLClasses.h>
- #include <cgicc/HTTPHTMLHeader.h>
- #include <chrono>
- #include <cinttypes>
- #include <ciso646>
- #include <climits>
- #include <clocale>
- #include <cmath>
- #include <codecvt>
- #include <complex.h>
- #include <complex>
- #include <condition_variable>
- #include <csetjmp>
- #include <csignal>
- #include <cstdalign>
- #include <cstdarg>
- #include <cstdbool>
- #include <cstddef>
- #include <cstdint>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <ctgmath>
- #include <ctime>
- #include <ctype.h>
- #include <cuchar>
- #include <cwchar>
- #include <cwctype>
- #include <deque>
- #include <errno.h>
- #include <exception>
- #include <fcntl.h>
- #include <fenv.h>
- #include <float.h>
- #include <forward_list>
- #include <fstream.h>
- #include <fstream>
- #include <functional>
- #include <future>
- #include <initializer_list>
- #include <inttypes.h>
- #include <iomanip.h>
- #include <iomanip>
- #include <ios>
- #include <iosfwd>
- #include <iostream.h>
- #include <iostream>
- #include <iso646.h>
- #include <istream>
- #include <iterator>
- #include <libgen.h>
- #include <limits.h>
- #include <limits>
- #include <list>
- #include <locale.h>
- #include <locale>
- #include <map>
- #include <math.h>
- #include <memory>
- #include <mutex>
- #include <new>
- #include <numeric>
- #include <ostream>
- #include <publib.h>
- #include <queue>
- #include <random>
- #include <ratio>
- #include <regex>
- #include <scoped_allocator>
- #include <set>
- #include <setjmp.h>
- #include <signal.h>
- #include <sstream>
- #include <stack>
- #include <stdalign.h>
- #include <stdarg.h>
- #include <stdbool.h>
- #include <stddef.h>
- #include <stdexcept>
- #include <stdint.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <streambuf>
- #include <string.h>
- #include <string>
- #include <strstrea.h>
- #include <strstream>
- #include <system_error>
- #include <tgmath.h>
- #include <thread>
- #include <time.h>
- #include <tuple>
- #include <type_traits>
- #include <typeindex>
- #include <typeinfo>
- #include <uchar.h>
- #include <unistd.h>
- #include <unordered_map>
- #include <unordered_set>
- #include <utility>
- #include <valarray>
- #include <vector>
- #include <vector>
- #include <wchar.h>
- #include <wctype.h>
- char ios::fill()
- int ios::bad()
- int ios::eof()
- int ios::fail()
- int ios::good()
- int ios::precision()
- int istream:: peek()
- int istream::gcount()
- int istream::get()
- long ios::flags()
- ostream& ostream::flush()
- void fstreambase::close()
- __DATE__
- __FILE__
- __LINE__
- __TIME__
- abort()
- abs()
- accumulate()
- acos()
- append()
- asin()
- assert()
- at()
- atan()
- atof()
- atoi()
- atol()
- back()
- back_inserter()
- bad()
- begin()
- bind2nd()
- bsearch()
- cat()
- ceil()
- char ios::fill(char c)
- chr()
- clear()
- clearerr()
- clock()
- close()
- cmp()
- copy()
- cos()
- cosh()
- cpy()
- cube()
- derivative()
- difftime()
- end()
- eof()
- equal()
- equal_to()
- erase()
- exit()
- exp()
- extremes()
- fabs()
- fail()
- fclose()
- fgetc()
- fgets()
- fill()
- find()
- flags()
- floor()
- flush()
- fopen()
- fprintf()
- fputc()
- fputs()
- fread()
- frequency()
- front()
- fscanf()
- fseek()
- ftell()
- fwrite()
- gcd()
- gcount()
- get()
- getc()
- getchar()
- getline()
- gets()
- good()
- ignore()
- inner_product()
- insert()
- int getchar()
- int ios::precision(int k)
- isPalindrome()
- isalnum()
- isalpha()
- iscntrl()
- isdigit()
- isgraph()
- islower()
- isprint()
- ispunct()
- isspace()
- istream& istream::get(signed char& c)
- isupper()
- isvowel()
- isxdigit()
- labs()
- largest()
- len()
- less()
- log()
- log10()
- long ios::flags(long n)
- main()
- max()
- memchr()
- memcmp()
- memcpy()
- memmove()
- memset()
- min()
- mirror()
- open()
- peek()
- perror()
- pop_back()
- pow()
- precision()
- print()
- printf()
- product()
- push_back()
- putback()
- rand()
- reduce()
- remove()
- reverse()
- riemann()
- root()
- rotate()
- set_new_handler()
- setw()
- sin()
- size()
- size_t strftime()
- sizeof()
- sort()
- sqrt()
- srand()
- strcat()
- strchr()
- strcmp()
- strcpy()
- strcspn()
- strlen()
- strncat()
- strncmp()
- strncpy()
- strpbrk()
- strrchr()
- strspn()
- strstr()
- strtok()
- sum()
- swap()
- system()
- time()
- tokenize()
- tolower()
- toupper()
- trap()
- void abort()
- int m=ios::in
- int m=ios::out
- int p=filebuf::openprot)
- ios::app
- ios::ate
- ios::in
- ios::out
- ios::trunc
- std::bad_alloc
- std::bad_cast
- std::bad_exception
- std::bad_typeid
- std::domain_error
- std::exception
- std::invalid_argument
- std::length_error
- std::logic_error
- std::out_of_range
- std::overflow_error
- std::range_error
- std::runtime_error
- std::string
- std::underflow_error
- char *asctime(const struct tm *time)
- char *ctime(const time_t *time)
- char*fgets(char*s int n FILE*p)
- char*gets(char*s)
- double atof(const char*s)
- int atoi(const char*s)
- int fclose(FILE*p)
- int fgetc(FILE*p)
- int fputc(int c FILE*p)
- int fputs(const char*s FILE*p)
- int fseek(FILE*p long k int base)
- int getc(FILE*p)
- int(*cmp)(const void *const void*)
- long atol(const char*s)
- long ftell(FILE*p)
- struct tm *gmtime(const time_t *time)
- struct tm *localtime(const time_t *time)
- time_t mktime(struct tm *time)
- time_t time(time_t *time)
- void clearerr(FILE*p)
- clock_t clock(void)
- double acos(double x)
- double asin(double x)
- double atan(double x)
- double ceil(double x)
- double cos(double x)
- double cos(double)
- double cosh(double x)
- double difftime(time_t time2 time_t time1)
- double exp(double x)
- double fabs(double x)
- double fabs(double)
- double floor(double x)
- double floor(double)
- double hypot(double double)
- double log(double x)
- double log(double)
- double pow(double double)
- double pow(double x double y)
- double sin(double)
- double sqrt(double)
- double tan(double)
- int abs(int n)
- int abs(int)
- int isalnum(int c)
- int isalpha(int c)
- int iscntrl(int c)
- int isdigit(int c)
- int isgraph(int c)
- int islower(int c)
- int isprint(int c)
- int ispunct(int c)
- int isspace(int c)
- int isupper(int c)
- int isxdigit(int c)
- int tolower(int c)
- int toupper(int c)
- long labs(long n)
- strcat(s1 s2)
- strchr(s1 ch)
- strcmp(s1 s2)
- strcpy(s1 s2)
- strlen(s1)
- strstr(s1 s2)
- void exit(int n)
- FILE*
- Auto
- Bool
- Break
- CONTENT_LENGTH
- CONTENT_TYPE
- Case
- Catch
- Char
- Class
- Const
- Const_cast
- Continue
- Default
- Delete
- Do
- HTTP_COOKIE
- HTTP_USER_AGENT
- INT_MAX
- INT_MIN
- MAX_RAND
- NULL
- PATH_INFO
- QUERY_STRING
- REMOTE_ADDR
- REMOTE_HOST
- REQUEST_METHOD
- SCRIPT_FILENAME
- SCRIPT_NAME
- SEEK_END
- SERVER_NAME
- SERVER_SOFTWARE
- SIGABRT
- SIGFPE
- SIGILL
- SIGINT
- SIGSEGV
- SIGTERM
- Try
- alignas
- alignof
- and
- and_eq
- append
- appending
- arg
- asm
- assign
- at
- attr
- auto
- back
- begin
- bitand
- bitaor
- bitor
- bitset
- bool
- break
- c_str
- capacity
- case
- cassert
- catch
- cbegin
- cctype
- cend
- char
- char16_t
- char32_t
- cin
- class
- clear
- cmath
- compare
- compl
- complex
- concept
- const
- const_cast
- const_iterator
- constexpr
- continue
- copy
- cout
- crbegin
- crend
- cstdio
- cstdlib
- cstring
- ctime
- data
- decltype
- default
- delete
- deque
- do
- double
- dynamic_cast
- else
- emplace
- emplace_backAsm
- empty
- end
- endl
- enum
- erase
- exception
- explicit
- export
- extern
- false
- find
- find_first_not_of
- find_first_of
- find_last_not_of
- find_last_of
- float
- for
- friend
- front
- get_allocator
- goto
- if
- ifstream
- inline
- insert
- int
- iomanip
- iostream
- istream
- istream&
- iterator
- length
- list
- long
- long double
- long int
- long long int
- main
- map
- max_size
- memchr
- memcmp
- memcpy
- memmove
- memset
- mutable
- namespace
- new
- noexcept
- not
- not_eq
- npos
- nullptr
- ofstream
- operator
- operator[]
- or
- or_eq
- ostream
- pair
- pop_back
- priority_queue
- private
- protected
- public
- push_back
- rbegin
- register
- reinterpret_cast
- rend
- replace
- requires
- reserve
- resize
- return
- rfind
- short
- short int
- shrink_to_fit
- signed
- signed char
- signed int
- signed long int
- signed short int
- size
- size_t
- sizeof
- stack
- start_routine
- static
- static_assert
- static_cast
- std
- strcat
- strchr
- strcmp
- strcoll
- strcpy
- strcspn
- strerror
- string
- strlen
- strncat
- strncmp
- strncpy
- strpbrk
- strrchr
- strspn
- strstr
- strtok
- struct
- strxfrm
- substr
- swap
- switch
- template
- this
- thread
- thread_local
- throw
- true
- try
- trytypedef
- typedef
- typeid
- typename
- union
- unsigned
- unsigned char
- unsigned int
- unsigned long int
- unsigned long long int
- unsigned short int
- using
- using namespace cgicc
- using namespace std
- valarray
- vector
- virtual
- void
- volatile
- wchar_t
- while
- xor
- xor_eq
- xor_eqalignas
- '''
- zzz = p() + ttt
- zzz = zzz.replace(' (','(')
- zzz = zzz.replace('( ','(')
- zzz = zzz.replace(' )',')')
- zzz = zzz.replace(') ',')')
- zzz = zzz.replace('* ','*')
- zzz = zzz.splitlines()
- zzz = list(set(zzz))
- for z in range(len(zzz)):
- for i in ['*']+['(']*3+['()']*6+[':']*6+['__']*12+['#']*15:
- if i in zzz[z]:
- zzz[z] = '@'+zzz[z]
- zzz.sort()
- # print '\n'.join(zzz).replace('@','')
- # print len(zzz)
- zzz = '''
- '''.splitlines()
- for i in range(len(zzz)):
- if ' // ' in zzz[i]:
- zzz[i] = zzz[i].split(' // ')[0].strip()
- zzz = list(set(zzz))
- zzz.sort()
- # print '"'+'" "'.join(zzz)+'"'
- print '\n'.join(zzz)
- # for my Google search
- "cin" "cout" "std" "sqrt" "namespace" "iostream" "const" "void" "float" "break" "catch" "char" "continue" "double" "int" "while" "goto" "case" "class"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement