artem3213212 / pypascaltokenizer Goto Github PK
View Code? Open in Web Editor NEWTokenizer for Pascal syntax (Delphi/FreePascal) written in Python 3
License: Mozilla Public License 2.0
Tokenizer for Pascal syntax (Delphi/FreePascal) written in Python 3
License: Mozilla Public License 2.0
s = (0,'//')
while is_comment(s[1]):
s = self.main.get_next()
судя по ридми, текст лежит не в [1] а в [0].
&77700
%110011
Must be one token
def is_comment(s):
return (s[0]=='{' and s[-1]=='}') or (s[:2]=='(*' and s[-2:]=='*)') or s[:2]=='//'
если токен точно валидный- мможно упростить-
return s.startswith('{') or s.startswith('(*') or s.startswith('//')
One token
1.2e-3
1e2
1e+20
не нашёл в стд Библ методов
__is_readable__ __doreadable__
так что не надо давать такие имена системные, можно с одним подчерком если ты скрыть хочешь
Need -= += /= *=
//parse <Address>
{
// <expression>
// [Rn]
// [Rn, offset] {!}
// [Rn,{+/-}Rm{,<shift>}]{!}
}
This block of comment breaks it.
yeah, this never ends.
Нужно шапку в начале
И файл Licensе
Напиши рус ридми, а я переведу, со списком что парсится
забыл переименовать.
Имхо- красивее set_pos, get_pos, в 1м стиле
CHAPTER 1. PASCAL TOKENS
+ -
*
/ = < > [ ] . , ( ) : ^ @ { } $ # & %
and the following character pairs too:
<< >>
**
<> >< <= >= := += -=
*= /= (* *) (. .) //
Когда думал что все вспомнил
Tokenizer for Pascal syntax (Delphi/FreePascal) written in Python 3
I0 i1– я так понял это y x , тогда надо так и назвать...
s=(0,'//')
while is_comment(s[1]):
return self.main
???
return в цикле??
индекс 1 или 0?
не принято одно подчерчивание в нач и конце.
два- да, в стандарт либе.
одно- только в начале.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.