Pragmatic directives: Difference between revisions
Content added Content deleted
(Pragmatic directives en QBasic) |
m (→{{header|Phix}}: updated for 1.0.2) |
||
Line 463: | Line 463: | ||
The following are taken directly from the Phix.syn (syntax colouring) file, which can be edited as needed (for errors or new compiler features): <br> |
The following are taken directly from the Phix.syn (syntax colouring) file, which can be edited as needed (for errors or new compiler features): <br> |
||
Delimiters #$:.%\^ <br> |
Delimiters #$:.%\^ <br> |
||
Operators , = := == != < <= > |
Operators , = := == != < <= > >= + - * / += -= *= /= .. & &= ? ; : | ~ .<br> |
||
Braces ()[]{} <br> |
Braces 7 ()[]{} <br> |
||
BlockComment /* */ --/* --*/ <br> |
BlockComment /* */ --/* --*/ #[ #] <br> |
||
LineComment -- <br> |
LineComment -- // <br> |
||
TokenStart abcedfghijklmnopqrstuvwxyz <br> |
TokenStart abcedfghijklmnopqrstuvwxyz <br> |
||
TokenStart ABCDEFGHIJKLMNOPQRSTUVWXYZ_ <br> |
TokenStart ABCDEFGHIJKLMNOPQRSTUVWXYZ_ <br> |
||
Line 474: | Line 474: | ||
The last line means that escapes in string literals start with a backslash, and there are 14 of them: CR, LF, |
The last line means that escapes in string literals start with a backslash, and there are 14 of them: CR, LF, |
||
TAB, backslash, single and double quotes, escape (#1B, e and E allowed), hex byte (# and x allowed), NUL, |
TAB, backslash, single and double quotes, escape (#1B, e and E allowed), hex byte (# and x allowed), NUL, |
||
backspace, and 4 and 8-digit unicode characters. |
backspace, and 4 and 8-digit unicode characters. The 7 in Braces is just the number of nested colours to use. |
||
(The above is further explained on [[[[Special_characters#Phix|Special_characters]]]]) |
(The above is further explained on [[[[Special_characters#Phix|Special_characters]]]]) |
||
Line 482: | Line 482: | ||
The #ilASM{} directive contains inline assembly, which can contain PE/ELF/32/64 guards to control the exact |
The #ilASM{} directive contains inline assembly, which can contain PE/ELF/32/64 guards to control the exact |
||
code emitted |
code emitted, mainly for low-level system routines, such as file I/O, which are usually in builtins\VM. One |
||
day I hope/expect to add a JS guard, for pwa/p2js, but there isn't one yet. |
|||
The #isginfo{}, #isinit{}, and #istype{} directives instruct the compiler to perform various type-inference |
The #isginfo{}, #isinit{}, and #istype{} directives instruct the compiler to perform various type-inference |
||
Line 489: | Line 490: | ||
The with/without directives control several run-time options: <br> |
The with/without directives control several run-time options: <br> |
||
javascript -- ensure pwa/p2js compatible, ie can be run in a browser, equivalent to js and javascript_semantics<br> |
|||
profile -- produce an execution count listing when the program terminates<br> |
profile -- produce an execution count listing when the program terminates<br> |
||
profile_time -- produce an execution percentage listing when the program terminates<br> |
profile_time -- produce an execution percentage listing when the program terminates<br> |
||
safe_mode -- see [[[[Untrusted_environment#Phix]]]]<br> |
|||
type_check -- turn user-defined type checking on or off (can make it noticeably faster, once testing is done)<br> |
type_check -- turn user-defined type checking on or off (can make it noticeably faster, once testing is done)<br> |
||
trace -- allow or disallow debugging (source code line-by-line tracing) <br> |
trace -- allow or disallow debugging (source code line-by-line tracing) <br> |
||
debug -- turn debugging info generation on or off <br> |
debug -- turn debugging info generation on or off <br> |
||
The last two are related: without debug completely removes all tracing and diagnostics for a specific file (primarily intended for use in well-tested system routines), whereas (under with debug, which is the default) with/without trace can make debugging less tedious by not stopping on every line of irrelevant (user-selected) code, although dumps still contain a full call stack. |
The last two are related: without debug completely removes all tracing and diagnostics for a specific file (primarily intended for use in well-tested system routines), whereas (under with debug, which is the default) with/without trace can make debugging less tedious by not stopping on every line of irrelevant (user-selected) code, although dumps still contain a full call stack. Some other options, specifically indirect_includes, inline, and digital stamps, exist solely for compatability and are completely ignored. |
||
with/without console/gui still work but should now be replaced with a format directive: |
with/without console/gui still work but should now be replaced with a format directive: |
||
format PE32|PE64|ELF32|ELF64 - you can also specify gui/console, subsystem version, icons and manifest files. Ignored when interpreting. |
format PE32|PE64|ELF32|ELF64 - you can also specify gui/console, subsystem version, icons and manifest files. Ignored when interpreting/transpiling. |
||
The following are ignored by the compiler, but are respected by the source code reindent tool: <br> |
The following are ignored by the compiler, but are respected by the source code reindent tool: <br> |
||
Line 507: | Line 510: | ||
--#withtype <br> |
--#withtype <br> |
||
Note that an abort() statement at the top level will make the compiler ignore the rest of the file. |
|||
While technically code rather than a directive, the requires() builtin can hopefully avoid fruitless efforts to run something where it is simply never going to work, eg |
|||
<!--<lang Phix>(phixonline)--> |
|||
<span style="color: #7060A8;">requires</span><span style="color: #0000FF;">(</span><span style="color: #004600;">JS</span><span style="color: #0000FF;">)</span> |
|||
<span style="color: #000080;font-style:italic;">--requires(WINDOWS) -- (one of only, or |
|||
--requires(LINUX) -- a special combo)</span> |
|||
<span style="color: #7060A8;">requires</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"1.0.2"</span><span style="color: #0000FF;">)</span> |
|||
<span style="color: #7060A8;">requires</span><span style="color: #0000FF;">(</span><span style="color: #000000;">32</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- or 64</span> |
|||
<!--</lang>--> |
|||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |