summaryrefslogtreecommitdiffstats
path: root/helpcontent2/source/text/sbasic/shared/conventions.xhp
blob: 974db923a305140bebad10c98cad0ef640def085 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
    <!--
    * This file is part of the LibreOffice project.
    *
    * This Source Code Form is subject to the terms of the Mozilla Public
    * License, v. 2.0. If a copy of the MPL was not distributed with this
    * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    *
     -->
    <meta>
        <topic id="org.LibreOffice.Help.conventions">
            <title id="tit" xml-lang="en-US">Syntax Diagrams</title>
            <filename>/text/sbasic/shared/conventions.xhp</filename>
        </topic>
    </meta>
    <body>
    <bookmark xml-lang="en-US" branch="index" id="bm_id861593777289558">
        <bookmark_value>Syntax diagrams; How to read</bookmark_value>
        <bookmark_value>Statements syntax;How to read</bookmark_value>
        <bookmark_value>Typographical conventions</bookmark_value>
    </bookmark>
    <h1 id="hd_id221543446540070"><link href="text/sbasic/shared/conventions.xhp" name="conventions">How to Read Syntax Diagrams and Statements</link></h1>
    <paragraph role="paragraph" id="par_id601593699108443">%PRODUCTNAME Basic statements use syntax diagrams and textual conventions that follow these typographical rules:</paragraph>
    <list type="unordered">
        <listitem><paragraph id="par_id158193699546735" role="listitem">%PRODUCTNAME Basic keywords or functions use proper casing: Call, DimArray, InputBox, Property.</paragraph></listitem>
        <listitem><paragraph id="par_id711593699548486" role="listitem">Lowercase characters indicate information to supply: end, expression, start, variable.</paragraph></listitem>
    </list>
    <paragraph role="paragraph" id="par_id881593760345504">The syntax of a %PRODUCTNAME Basic one line statement is illustrated herewith:</paragraph>

    <h2 id="hd_id871593700670279">Diagram example</h2>
    <list type="unordered">
        <listitem><paragraph id="par_id181593699574635" role="listitem">Basic statement diagrams start and end with double vertical bars,</paragraph></listitem>
        <listitem><paragraph id="par_id711596399548486" role="listitem">Loops indicate a possible repetition, an optional separator may be present,</paragraph></listitem>
        <listitem><paragraph id="par_id541593706654897" role="listitem">Rectangles denote subsequent diagram fragments,</paragraph></listitem>
        <listitem><paragraph id="par_id251593706717957" role="listitem">Diagram fragments extremities exhibit single vertical bars.</paragraph></listitem>
    </list>
    <paragraph role="image" id="par_id831588865616326"><image src="media/helpimg/sbasic/a_statement.svg" id="img_id651588865616326"><alt id="alt_id281588865616326">syntax of a statement</alt></image></paragraph>
    <paragraph role="paragraph" id="par_id411579301639711">A set of %PRODUCTNAME Basic statements - with  optional labels - is using a colon <literal>:</literal> sign to separate them, it can be terminated with an optional comment. <literal>REM</literal> or an apostrophe sign introduce a comment.</paragraph>
    <paragraph role="image" id="par_id931593707147102"><image src="media/helpimg/sbasic/comment_fragment.svg" id="img_id191593707147102"><alt id="alt_id111593707147102">diagram fragment</alt></image></paragraph>

    <h2 id="hd_id71593700691968">Textual example</h2>
    <section id="Typography">
    <list type="unordered">
        <listitem><paragraph id="par_id181593700546735" role="listitem"><emph>[opt1|opt2|opt3]</emph> Items inside brackets are optional, alternatives are indicated with a vertical bar,</paragraph></listitem>
        <listitem><paragraph id="par_id181593699546735" role="listitem"><emph>case[[sep]…]</emph> An ellipsis indicates a possible repetition, an optional separator may be specified,</paragraph></listitem>
        <listitem><paragraph id="par_id712593699548486" role="listitem"><emph>{choice1|choice2}</emph> Items inside curly braces are compulsory, alternatives are indicated with a vertical bar.</paragraph></listitem>
    </list>
    </section>

    <paragraph role="paragraph" id="par_id881593759547050" localize="false"><literal>[ [label:] statement [: …] ] [{REM|'} text]</literal></paragraph>

    <paragraph role="paragraph" id="par_id411593701639711">A set of %PRODUCTNAME Basic statements - with  optional labels - is using a colon <literal>:</literal> sign to separate them, it can be terminated with an optional comment. <literal>REM</literal> or an apostrophe sign introduce a comment.</paragraph>

    <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
    <bascode>
       <paragraph role="bascode" id="N0008" localize="false">Sub Main<br/></paragraph>
       <paragraph role="bascode" id="N0018" xml-lang="en-US">    GoTo there &apos; skip first statement</paragraph>
       <paragraph role="bascode" id="N0019" xml-lang="en-US">    here: Print 1, : there: Print 2 REM explanatory text here</paragraph>
       <paragraph role="bascode" id="N0021" localize="false">End Sub</paragraph>
    </bascode>

    <section id="relatedtopics" >
        <embed href="text/sbasic/shared/03090302.xhp#GoToh1"/>
        <embed href="text/sbasic/shared/03010103.xhp#Print_h1"/>
        <embed href="text/sbasic/shared/03090407.xhp#remstatement"/>
        <embed href="text/sbasic/shared/03090409.xhp#Sub_h1"/>
    </section>
</body>
</helpdocument>