Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
diff docs/example-1.pseudocode @ 107:1c1985532139
A couple of real pseudocode examples.
Examples are from the Wikipedia.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 04 May 2026 16:57:17 +0200 |
| parents | |
| children | 4acf578ae93f |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/example-1.pseudocode Mon May 04 16:57:17 2026 +0200 @@ -0,0 +1,47 @@ +// -*- coding: utf-8; indent-tabs-mode: nil -*- +\PROGRAM {The Pseudocode Lexer} \IS + + /* + * The program is here, but it also could be an \ALGORITHM + * + * /* YES! Nested multiline comments work! */ + */ + + \PROC {A Procedure name} \IS + \TBLOCK {A text block 1} + \TBLOCK {A text block 2 with an expression: \expr{flag is FALSE}} + \BLOCK { + \REMARK A remark on its own line within a "BLOCK" + } + \END-PROC {A Procedure name} + + \FUNCTION{A Function with {escaped\} text} \IS + a and b xor (c in d) \rem this is another remark + \block {foo bar} + + \IF a is nil \THEN + \text{Set something} + \ELSEIF + \text{Set some other thing} + \END-IF + \END FUNCTION{A Function with {escaped\} text} + + \CLASS{A Class} \IS + // This is a one-line comment + a and b xor (c in d) \rem this is another remark + + # This is another one-line comment + \block {foo + bar} + \block{a 1.2 {x in X\} c} + \tstate{We will compute next \expr{a xor b or (\text{set} X is Empty)} \rem without c! + or multiply it the other way round} + + \tstate{foo bar \rem A remark within a text statement until LF! + nextfoo nextbar + nextnextfoo nextnextbar} + \ENDCLASS{A Class} + + @A_XXX + FOO BAR +\ENDPROG
