.. _label4:
-OMake言語の概要と構文
+4. OMake言語の概要と構文
==================================
.. Projects are specified to omake with OMakefiles. The OMakefile has a format similar to a Makefile. An OMakefile has three main kinds of syntactic objects: variable definitions, function definitions, and rule definitions.
single: 変数
.. _label4.1:
-変数
+4.1 変数
-------------
.. Variables are defined with the following syntax. The name is any sequence of alphanumeric characters, underscore _, and hyphen -.
.. _label4.2:
-変数に値を追加
+4.2 変数に値を追加
---------------------
.. Variables definitions may also use the += operator, which adds the new text to an existing definition. The following two definitions are equivalent.
single: 配列
.. _label4.3:
-配列
+4.3 配列
---------------------
.. Arrays can be defined by appending the [] sequence to the variable name and defining initial values for the elements as separate lines. Whitespace is significant on each line. The following code sequence prints c d e.
single: クオーティング
.. _label4.4:
-特殊文字とクオート
+4.4 特殊文字とクオート
-----------------------
.. The following characters are special to omake: $():,=#\. To treat any of these characters as normal text, they should be escaped with the backslash character \.
single: value
.. _label4.5:
-関数定義
+4.5 関数定義
----------------
.. Functions are defined using the following syntax.
single: コメント
.. _label4.6:
-コメント
+4.6 コメント
----------------
.. Comments begin with the # character and continue to the end of the line.
single: open
.. _label4.7:
-ファイルのインクルード
+4.7 ファイルのインクルード
-----------------------------
.. Files may be included with the include or open form. The included file must use the same syntax as an OMakefile.
single: export
.. _label4.8:
-スコーピング、セクション
+4.8 スコーピング、セクション
-------------------------------
.. Scopes in omake are defined by indentation level. When indentation is increased, such as in the body of a function, a new scope is introduced.
single: if
.. _label4.9:
-条件分岐
+4.9 条件分岐
----------------
.. Top level conditionals have the following form.
single: 正規表現
.. _label4.10:
-マッチング
+4.10 マッチング
-------------------
.. Pattern matching is performed with the switch and match forms.
single: メソッド
.. _label4.11:
-オブジェクト
+4.11 オブジェクト
---------------------
.. OMake is an object-oriented language. Generally speaking, an object is a value that contains fields and methods. An object is defined with a . suffix for a variable. For example, the following object might be used to specify a point (1, 5) on the two-dimensional plane.
single: class
.. _label4.12:
-クラス
+4.12 クラス
---------------
.. We can also define classes. For example, suppose we wish to define a generic Point class with some methods to create, move, and print a point. A class is really just an object with a name, defined with the class directive.
single: 継承
.. _label4.13:
-継承
+4.13 継承
---------------
.. Classes and objects support inheritance (including multiple inheritance) with the extends directive. The following definition of Point3D defines a point with x, y, and z fields. The new object inherits all of the methods and fields of the parent classes/objects.
single: ConfMsgResult()
.. _label4.14:
-static.
+4.14 static.
---------------
.. The static. object is used to specify values that are persistent across runs of OMake. They are frequently used for configuring a project. Configuring a project can be expensive, so the static. object ensure that the configuration is performed just once. In the following (somewhat trivial) example, a static section is used to determine if the LATEX command is available. The $(where latex) function returns the full pathname for latex, or false if the command is not found.
single: awk()
.. _label4.14.1:
-.STATIC
+4.14.1 .STATIC
^^^^^^^^^^^^^^^^^^
.. This feature was introduced in version 0.9.8.5.
single: .MEMO
.. _label4.14.1.1:
-.MEMO
+4.14.1.1 .MEMO
""""""""""""""""""
.. A .MEMO rule is just like a .STATIC rule, except that the results are not saved between independent runs of omake.
single: 再帰関数
.. _label4.14.1.2:
-\:key:
+4.14.1.2 :key:
""""""""""""""""""
.. The .STATIC and .MEMO rules also accept a :key: value, which specifies a “key” associated with the values being computed. It is useful to think of a .STATIC rule as a dictionary that associates keys with their values. When a .STATIC rule is evaluated, the result is saved in the table with the :key: defined by the rule (if a :key: is not specified, a default key is used instead). In other words, a rule is like a function. The :key: specifies the function “argument”, and the rule body computes the result.
single: パーサ
.. _label4.15:
-定数
+4.15 定数
-----------------
.. Internally, OMake represents values in several forms, which we list here.