Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 1/Identifiers/ja: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
111B - 識別子 (著者: Tao Yue, 状態: 修正あり)
22
33識別子とは保存された値、たとえば変数や定数を参照するための名前である。また、プログラムも識別子によって識別されなくてはならない。
44
55識別子の規則:
66
7-`   英語のアルファベットかアンダースコア(_)の文字ではじまらなくてはならない。`\
8-`   その後にはアルファベット・数字、あるいはアンダースコア(_)を続けることができる。`\
9-`   以下のような特殊記号は含めてはならない。 `
7+```
8+ 英語のアルファベットかアンダースコア(_)の文字ではじまらなくてはならない。
9+ その後にはアルファベット・数字、あるいはアンダースコア(_)を続けることができる。
10+ 以下のような特殊記号は含めてはならない。
11+```
1012
11-`` ~ ! @ # $ % ^ & * ( ) + ` - = { } [ ] : " ; ' < > ? , . / | \ ``
13+```
14+~ ! @ # $ % ^ & * ( ) + ` - = { } [ ] : " ; ' < > ? , . / | \
15+```
1216
1317目次 \[hide\]
1418
15-`   1 予約語`\
16-`       1.1 Turbo Pascal の予約語`\
17-`       1.2 Delphi の予約語`\
18-`       1.3 Free Pascal の予約語`
19+```
20+ 1 予約語
21+ 1.1 Turbo Pascal の予約語
22+ 1.2 Delphi の予約語
23+ 1.3 Free Pascal の予約語
24+```
1925
2026## 予約語
2127
2228識別子の中には Pascal で予約されており、自分の識別子として利用できないものがある。FPC のリファレンスによれば、それらは次のようにグループ化される。
2329
24-`   Turbo Pascal の予約語`\
25-`   Delphi の予約語`\
26-`   FPC の予約語 `
30+```
31+ Turbo Pascal の予約語
32+ Delphi の予約語
33+ FPC の予約語
34+```
2735
2836## Turbo Pascal の予約語
2937
3038| | | | | | | | |
3139|----|----|----|----|----|----|----|----|
3240| absolute | and | array | asm | begin | break | case | const |
3341| constructor | continue | destructor | div | do | downto | else | end |
3442| file | for | function | goto | if | implementation | in | inherited |
3543| inline | interface | label | mod | nil | not | object | of |
3644| on | operator | or | packed | procedure | program | record | reintroduce |
3745| repeat | self | set | shl | shr | string | then | to |
3846| type | unit | until | uses | var | while | with | xor |
3947
4048## Delphi の予約語
4149
4250The Delphi (II) の予約語は Pascal の予約語と同じものに加えて以下のものである。
4351
4452| | | | | | | |
4553|-----|---------|--------|----------|--------------|-----------|----------------|
4654| as | class | except | exports | finalization | finally | initialization |
4755| is | library | on | property | raise | threadvar | try |
4856
4957## Free Pascal の予約語
5058
5159Turbo Pascal と Delphi の予約語に、Free Pascal はまた予約語として以下のものを含む。
5260
5361| | | | | |
5462|---------|------|-------|-----|------|
5563| dispose | exit | false | new | true |
5664
5765また、Pascal には事前に定義された識別子がある。それらを自分自身の定義と置き換えることはできるが、 Pascal の機能の一部は除かれてしまう。
5866
5967| | | | | | | | |
6068|-------|-------------|---------|---------|------|---------|--------|------|
6169| abs | arctan | boolean | char | cos | dispose | eof | eoln |
6270| exp | false | input | integer | ln | maxint | new | odd |
6371| ord | output | pack | page | pred | read | readln | real |
6472| reset | rewrite | round | sin | sqr | sqrt | succ | text |
6573| true | trunc write | writeln | | | | | |
6674
6775Pascal は大文字、小文字を区別しない! MyProgram、MYPROGRAM と mYpRoGrAm は同じになる。しかし、可読性を上げるために意味があるように大文字を使用した方がよいだろう!
6876
6977識別子はどんな長さでもよいが、多くの Pascal コンパイラは最初の32文字(あるいはそれぐらい)だけを見る。つまり、以下の2つは、32文字以降しか違わないので Pascal コンパイラには同じものと見なされるかもしれない。
7078
71-`   ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFAlphaBeta`\
72-`   ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGammaDelta`
79+```
80+ ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFAlphaBeta
81+ ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGammaDelta
82+```
7383
7484すべてのコンパイラで互換性を持たせるためには識別子は無理のない長さ、せいぜい15文字までにした方がよい。そうすることでタイプする手間も省けるだろう。
7585
7686| | | |
7787|----|----|----|
7888| [[Basic Pascal Tutorial/Chapter 1/Program Structure/ja|previous]] | [[Basic Pascal Tutorial/Contents/ja|contents]] | [[Basic Pascal Tutorial/Chapter 1/Constants/ja|next]] |
7989
8090---
8191*From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 1/Identifiers/ja", as it stood on 2022-08-20 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history