- Expert Delphi
- Pawe? G?owacki
- 351字
- 2021-07-02 20:44:23
Tokens
Tokens are the smallest meaningful pieces of text that a compiler understands. Tokenization is the very first thing that the compiler does when starting to process a source code file. There are different types of tokens, including identifiers, numbers, strings, constants, and special symbols. An Object Pascal program is made up of tokens and separators. A separator is either a blank space or a comment. There must be at least one separator between tokens.
In Object Pascal source code, you can use any Unicode characters for identifiers, but it makes a lot of sense to stick to just ASCII characters and consistently use just the English language in your code. Different Object Pascal language elements are in English, and it is easier to work with other programmers who might use other languages as their mother tongue.
The Delphi Code Editor displays different fragments of Delphi source code using different colors. Some words are displayed in bold and some others in italics. The color scheme of the Code Editor can be customized in the IDE Options, but here we will stick to the defaults.
The Object Pascal language defines a set of reserved words that the compiler knows about, and they cannot be used as identifiers in our code. Keywords are displayed in bold, so they are easy to spot. Keywords have a special meaning to the compiler. For example, if you try to save your program as program, you would get an error message that program is a reserved word and cannot be used as an identifier. If, for some reason, you really want to use a keyword as an identifier in your code, you can escape it by prepending the identifier with the & character.
Identifiers are used for constants, types, variables, procedures, functions, units, programs, and fields in records. An identifier must begin with a letter or an underscore character and cannot contain spaces. Letters, digits, and underscore characters are allowed after the first character. Identifiers and reserved words are not case sensitive. Sometimes, you may want to qualify an identifier with its unit name to avoid ambiguity.
- Boost程序庫(kù)完全開(kāi)發(fā)指南:深入C++”準(zhǔn)”標(biāo)準(zhǔn)庫(kù)(第5版)
- Learning ROS for Robotics Programming(Second Edition)
- 算法訓(xùn)練營(yíng):入門(mén)篇(全彩版)
- 從程序員到架構(gòu)師:大數(shù)據(jù)量、緩存、高并發(fā)、微服務(wù)、多團(tuán)隊(duì)協(xié)同等核心場(chǎng)景實(shí)戰(zhàn)
- R語(yǔ)言編程指南
- Android NDK Beginner’s Guide
- 3D少兒游戲編程(原書(shū)第2版)
- Learning Concurrency in Kotlin
- INSTANT Sinatra Starter
- 監(jiān)控的藝術(shù):云原生時(shí)代的監(jiān)控框架
- Python大規(guī)模機(jī)器學(xué)習(xí)
- Hacking Android
- Python應(yīng)用開(kāi)發(fā)技術(shù)
- Pandas 1.x Cookbook
- 從零開(kāi)始學(xué)UI設(shè)計(jì)·基礎(chǔ)篇