当前位置:网站首页>[2. Basics of Delphi grammar] 1 Identifiers and reserved words
[2. Basics of Delphi grammar] 1 Identifiers and reserved words
2022-07-03 16:47:00 【Janeb1018】
1. Identifiers and reserved words
stay Object Pascal in , Symbols consist of one or more characters , Is the most basic language element .
1.1 identifier
The identifier is ObjectPascal Variables in language 、 Constant 、 type 、 The process 、 function 、 Method 、 Name of unit, etc .
Standard Identifier
The standard identifier is ObjectPascal Language is pre assigned to standard functions 、 Standard process 、 Standard type 、 Standard constant 、 Identifiers used in standard documents .
Standard constant Such as :False、True、Maxint etc.
Standard type Such as :Boolean、Char、Real etc.
Standard functions Such as :Sin、Cos、Abs、Arctan etc.
Standard process Such as :Dispose、Get、New、Pack、Put etc.
Standard document Such as :Input、Output etc.
Custom identifier
Custom identifiers are based on the needs of program design , Self defined constants 、 Variable 、 type 、 function 、 Name of process, etc . stay Object Pascal Rules for defining identifiers in :
1. Identifiers are case insensitive 2. Identifiers can only start with letters or underscores 3. Identifier can be any length , But only before 255 Characters are valid 4. No space is allowed between identifiers 5. Not allowed Object Pascal Reserved word as identifier
Qualified identifier
stay Object Pascal Multiple units can be referenced in , And the global variables in each unit 、 function 、 Process, etc. may have the same name , therefore , When referenced in the program, you need to use qualified identifiers to distinguish . Such as :
Var Y: real; Y := System.cos(pi);
In code System Is the qualified identifier , limit cos The identifier is System The identifier declared in the unit .
1.2 Reserved words
Reserved words are specified by the system , Words with special meanings and uses , It cannot be redefined in programming .Object Pascal It defines 65 A reserved word :
| Reserved words | |||||
|---|---|---|---|---|---|
| and | array | as | asm | begin | case |
| class | Const | constructor | destructor | dispinterface | div |
| do | downto | else | end | except | exports |
| file | finalization | finally | for | function | goto |
| if | implementation | in | inherite | initialization | inline |
| is | interface | label | library | mod | Nil |
| not | object | of | or | out | packed |
| procedure | program | property | raise | record | repeat |
| resourcestring | set | shl | shr | string | then |
| threadvar | to | try | type | until | unit |
| uses | var | while | with | xor |
1.3 Instruction character
Directives are also words with special meanings . Directives are only used in special program locations or meaningful program segments when context is associated , It can be redefined in other occasions .Object Pascal Specified in the 39 Directive characters :
| Instruction character | |||||
|---|---|---|---|---|---|
| absolute | abstract | assembler | automated | cdecl | contains |
| default | dispid | dynamic | export | external | far |
| forward | implements | index | message | name | near |
| nodefault | overload | override | package | pascal | private |
| protected | public | published | read | readonly | register |
| reintroduce | requires | resident | safecall | stdcall | stored |
| virtual | write | writeonly |
1.4 Summary of reserved words and directives
| Reserved word or directive | purpose |
|---|---|
| absolute | Instructions ( Variable ) |
| abstract | Instructions ( Method ) |
| and | Operator ( Boolean ) |
| array | type |
| as | Operator (RTTI) |
| asm | sentence |
| assembler | Backward compatibility ( assembly ) |
| at | sentence ( exception handling ) |
| automated | Access the category symbol ( class ) |
| begin | Block marker |
| case | sentence |
| cdecl | Function call protocol |
| class | type |
| const | A statement or instruction ( Parameters ) |
| constructor | Special methods |
| contains | Operator ( aggregate ) |
| default | Instructions ( attribute ) |
| destructor | Special methods |
| dispid | dispinterface Interface class symbol |
| dispinterface | type |
| div | Operator |
| do | sentence |
| downto | sentence (for) |
| dynamic | Instructions ( Method ) |
| else | sentence (if or case) |
| end | Block marker |
| except | sentence ( exception handling ) |
| export | Backward compatibility ( class ) |
| exports | Statement |
| external | Instructions ( function ) |
| far | Backward compatibility ( class ) |
| file | type |
| finalization | Unit structure |
| finally | sentence ( exception handling ) |
| for | sentence |
| forward | Function instructions |
| function | Statement |
| goto | sentence |
| if | sentence |
| implementation | Unit structure |
| implements | Instructions ( attribute ) |
| in | Operator ( aggregate ) |
| index | Instructions (dispinterface Interface ) |
| inherited | sentence |
| initialization | Unit structure |
| inline | Backward compatibility ( see asm) |
| interface | type |
| is | Operator (RTTI) |
| label | Statement |
| library | Program structure |
| message | Instructions ( Method ) |
| mod | Operator ( mathematics ) |
| name | Instructions ( function ) |
| near | Backward compatibility ( class ) |
| nil | The number |
| nodefault | Instructions ( attribute ) |
| not | Operator ( Boolean ) |
| object | Backward compatibility ( class ) |
| of | sentence (case) |
| on | sentence ( exception handling ) |
| or | Operator ( Boolean ) |
| out | Instructions ( Parameters ) |
| overload | Function instructions |
| override | Function instructions |
| package | Program structure ( Control pack ) |
| packed | Instructions ( Record ) |
| pascal | Function call protocol |
| private | Access the category symbol (class) |
| procedure | Statement |
| program | Program structure |
| property | Statement |
| protected | Access the category symbol ( class ) |
| public | Access the category symbol ( class ) |
| published | Access the category symbol ( class ) |
| raise | sentence ( exception handling ) |
| read | Property class |
| readonly | dispatch Interface class symbol |
| record | type |
| register | Function call protocol |
| reintroduce | Function instructions |
| repeat | sentence |
| requires | Program structure ( Control pack ) |
| resident | Instructions ( function ) |
| resourcestring | type |
| safecall | Function call protocol |
| set | type |
| shl | Operator ( mathematics ) |
| shr | Operator ( mathematics ) |
| stdcall | Function call protocol |
| stored | Instructions ( attribute ) |
| string | type |
| then | sentence (if) |
| threadvar | Statement |
| to | sentence (for) |
| try | sentence ( exception handling ) |
| type | Statement |
| unit | Unit structure |
| until | sentence |
| uses | Unit structure |
| var | Statement |
| virtual | Instructions ( Method ) |
| while | sentence |
| with | sentence |
| write | Property class |
| writeonly | dispatch Interface class symbol |
| xor | Operator ( Boolean ) |
1.5 notes
Object Pascal Notes in language :
Combination symbol { And } Use in pairs to indicate that the included content is annotation content .
Combination symbol (* And *) Use in pairs to indicate that the included content is annotation content .
Symbol // The single use of indicates that the content after the symbol in the line is the annotation content .
for example :
{ Curly bracket comment }
(* parentheses / Asterisk notes *)
//C++ Style notes Be careful , Do not nest notes of the same type . Although different types of annotations are syntactically legitimate , But this is not recommended . for example :
{(* It's legal *)}
(*{ It's legal }*)
(*(* It's illegal *)*)
{
{ It's illegal }}边栏推荐
- [combinatorics] recursive equation (outline of recursive equation content | definition of recursive equation | example description of recursive equation | Fibonacci Series)
- 【剑指 Offer 】57 - II. 和为s的连续正数序列
- Nifi from introduction to practice (nanny level tutorial) - flow
- PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
- One article takes you to understand machine learning
- What is the maximum number of concurrent TCP connections for a server? 65535?
- Alibaba P8 painstakingly sorted it out. Summary of APP UI automated testing ideas. Check it out
- Capacités nécessaires à l'analyse des données
- 关于视觉SLAM的最先进技术的调查-A survey of state-of-the-art on visual SLAM
- Hands on in-depth learning notes (XIV) 3.7 Simple implementation of softmax regression
猜你喜欢

Learn from me about the enterprise flutter project: simplified framework demo reference

arduino-esp32:LVGL项目(一)整体框架

What is the difference between 14Cr1MoR container plate and 14Cr1MoR (H)? Chemical composition and performance analysis of 14Cr1MoR

TCP congestion control details | 3 design space

Google Earth engine (GEE) - daymet v4: daily surface weather data set (1000m resolution) including data acquisition methods for each day

Processing strategy of message queue message loss and repeated message sending

2022 love analysis · panoramic report of digital manufacturers of state-owned enterprises

What is the material of sa302grc? American standard container plate sa302grc chemical composition

Mysql database DDL and DML

What material is 13crmo4-5 equivalent to in China? 13crmo4-5 chemical composition 13crmo4-5 mechanical properties
随机推荐
MySQL Basics
[solved] access denied for user 'root' @ 'localhost' (using password: yes)
What is the maximum number of concurrent TCP connections for a server? 65535?
PHP secondary domain name session sharing scheme
数据分析必备的能力
[sword finger offer] 58 - I. flip the word order
CC2530 common registers for port interrupts
Characteristic polynomial and constant coefficient homogeneous linear recurrence
Hands on in-depth learning notes (XIV) 3.7 Simple implementation of softmax regression
Basis of target detection (IOU)
One article takes you to understand machine learning
【剑指 Offer 】64. 求1+2+…+n
Cocos Creator 2.x 自动打包(构建 + 编译)
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
JSON 与 BSON 区别
NLP四范式:范式一:非神经网络时代的完全监督学习(特征工程);范式二:基于神经网络的完全监督学习(架构工程);范式三:预训练,精调范式(目标工程);范式四:预训练,提示,预测范式(Prompt工程)
Le zèbre a été identifié comme un chien, et la cause de l'erreur d'AI a été trouvée par Stanford
A survey of state of the art on visual slam
ucore概述
消息队列消息丢失和消息重复发送的处理策略