diff --git a/c.html b/c.html index 5c4a95a..4608226 100644 --- a/c.html +++ b/c.html @@ -78,6 +78,10 @@

Styles

Default Style +
  • + + Dracula Style
  • +
  • Emacs Style
  • @@ -184,8 +188,6 @@

    Languages

  • HTML
  • -
  • JSON
  • - @@ -232,7 +234,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.abap_style()
    +  
    Makeup.Styles.HTML.StyleMap.abap_style()
     

    @@ -251,7 +253,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -264,70 +266,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -338,7 +340,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.algol_style()
    +  
    Makeup.Styles.HTML.StyleMap.algol_style()
     

    @@ -357,7 +359,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -370,70 +372,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -444,7 +446,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.algol_nu_style()
    +  
    Makeup.Styles.HTML.StyleMap.algol_nu_style()
     

    @@ -463,7 +465,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -476,70 +478,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -550,7 +552,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.arduino_style()
    +  
    Makeup.Styles.HTML.StyleMap.arduino_style()
     

    @@ -569,7 +571,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -582,70 +584,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -656,7 +658,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.autumn_style()
    +  
    Makeup.Styles.HTML.StyleMap.autumn_style()
     

    @@ -675,7 +677,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -688,70 +690,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -762,7 +764,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.borland_style()
    +  
    Makeup.Styles.HTML.StyleMap.borland_style()
     

    @@ -781,7 +783,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -794,70 +796,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -868,7 +870,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.bw_style()
    +  
    Makeup.Styles.HTML.StyleMap.bw_style()
     

    @@ -887,7 +889,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -900,70 +902,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -974,7 +976,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.colorful_style()
    +  
    Makeup.Styles.HTML.StyleMap.colorful_style()
     

    @@ -993,7 +995,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -1006,70 +1008,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -1080,7 +1082,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.default_style()
    +  
    Makeup.Styles.HTML.StyleMap.default_style()
     

    @@ -1099,7 +1101,113 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); + +static stringBuffer* staticVariableBuffer; +static stringBuffer* classInitBuffer; +static stringBuffer* currentMethodBuffer; +static stringBuffer* finishedMethodsBuffer; +static stringBuffer* mainBuffer; + +static int currentMethodBufferIndex; +static int currentMethodStackSize; +static int currentMethodStackSizeMax; +static int currentMethodNumberOfLocals; + +char tempString[MAX_LENGTH_OF_COMMAND]; + +extern char* className; /* from minako-syntax.y */ + +/* forward declarations */ +static void increaseStackby(int stackdiff); +char convertType(int type); + +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); + currentMethodBuffer = 0; + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + classInitBufferIndex = classInitBuffer->numberOfNextElement; + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    + + +

    + Dracula Style (dracula)¶ +

    + +

    + You can access this style as: +

    + +
    Makeup.Styles.HTML.StyleMap.dracula_style()
    +
    + +

    + And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you. +

    + + +

    + example.c¶ +

    + +
    #include <string.h>
    +#include <stdlib.h>
    +#include <stdio.h>
    +#include "codegen.h"
    +#include "symboltable.h"
    +#include "stringbuffer.h"
    +
    +extern void yyerror(char* msg);
     
     static stringBuffer* staticVariableBuffer;
     static stringBuffer* classInitBuffer;
    @@ -1112,70 +1220,70 @@ 

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -1186,7 +1294,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.emacs_style()
    +  
    Makeup.Styles.HTML.StyleMap.emacs_style()
     

    @@ -1205,7 +1313,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -1218,70 +1326,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -1292,7 +1400,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.friendly_style()
    +  
    Makeup.Styles.HTML.StyleMap.friendly_style()
     

    @@ -1311,7 +1419,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -1324,70 +1432,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -1398,7 +1506,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.fruity_style()
    +  
    Makeup.Styles.HTML.StyleMap.fruity_style()
     

    @@ -1417,7 +1525,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -1430,70 +1538,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -1504,7 +1612,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.igor_style()
    +  
    Makeup.Styles.HTML.StyleMap.igor_style()
     

    @@ -1523,7 +1631,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -1536,70 +1644,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -1610,7 +1718,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.lovelace_style()
    +  
    Makeup.Styles.HTML.StyleMap.lovelace_style()
     

    @@ -1629,7 +1737,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -1642,70 +1750,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -1716,7 +1824,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.manni_style()
    +  
    Makeup.Styles.HTML.StyleMap.manni_style()
     

    @@ -1735,7 +1843,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -1748,70 +1856,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -1822,7 +1930,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.monokai_style()
    +  
    Makeup.Styles.HTML.StyleMap.monokai_style()
     

    @@ -1841,7 +1949,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -1854,70 +1962,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -1928,7 +2036,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.murphy_style()
    +  
    Makeup.Styles.HTML.StyleMap.murphy_style()
     

    @@ -1947,7 +2055,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -1960,70 +2068,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -2034,7 +2142,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.native_style()
    +  
    Makeup.Styles.HTML.StyleMap.native_style()
     

    @@ -2053,7 +2161,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -2066,70 +2174,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -2140,7 +2248,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.paraiso_dark_style()
    +  
    Makeup.Styles.HTML.StyleMap.paraiso_dark_style()
     

    @@ -2159,7 +2267,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -2172,70 +2280,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -2246,7 +2354,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.paraiso_light_style()
    +  
    Makeup.Styles.HTML.StyleMap.paraiso_light_style()
     

    @@ -2265,7 +2373,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -2278,70 +2386,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -2352,7 +2460,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.pastie_style()
    +  
    Makeup.Styles.HTML.StyleMap.pastie_style()
     

    @@ -2371,7 +2479,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -2384,70 +2492,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -2458,7 +2566,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.perldoc_style()
    +  
    Makeup.Styles.HTML.StyleMap.perldoc_style()
     

    @@ -2477,7 +2585,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -2490,70 +2598,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -2564,7 +2672,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.rainbow_dash_style()
    +  
    Makeup.Styles.HTML.StyleMap.rainbow_dash_style()
     

    @@ -2583,7 +2691,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -2596,70 +2704,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -2670,7 +2778,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.rrt_style()
    +  
    Makeup.Styles.HTML.StyleMap.rrt_style()
     

    @@ -2689,7 +2797,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -2702,70 +2810,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -2776,7 +2884,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.tango_style()
    +  
    Makeup.Styles.HTML.StyleMap.tango_style()
     

    @@ -2795,7 +2903,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -2808,70 +2916,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -2882,7 +2990,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.trac_style()
    +  
    Makeup.Styles.HTML.StyleMap.trac_style()
     

    @@ -2901,7 +3009,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -2914,70 +3022,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -2988,7 +3096,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.vim_style()
    +  
    Makeup.Styles.HTML.StyleMap.vim_style()
     

    @@ -3007,7 +3115,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -3020,70 +3128,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -3094,7 +3202,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.vs_style()
    +  
    Makeup.Styles.HTML.StyleMap.vs_style()
     

    @@ -3113,7 +3221,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -3126,70 +3234,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +}

    @@ -3200,7 +3308,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.xcode_style()
    +  
    Makeup.Styles.HTML.StyleMap.xcode_style()
     

    @@ -3219,7 +3327,7 @@

    #include "symboltable.h" #include "stringbuffer.h" -extern void yyerror(char* msg); +extern void yyerror(char* msg); static stringBuffer* staticVariableBuffer; static stringBuffer* classInitBuffer; @@ -3232,70 +3340,70 @@

    static int currentMethodStackSizeMax; static int currentMethodNumberOfLocals; -char tempString[MAX_LENGTH_OF_COMMAND]; +char tempString[MAX_LENGTH_OF_COMMAND]; extern char* className; /* from minako-syntax.y */ /* forward declarations */ -static void increaseStackby(int stackdiff); -char convertType(int type); +static void increaseStackby(int stackdiff); +char convertType(int type); -void codegenInit() { - staticVariableBuffer = newStringBuffer(); - classInitBuffer = newStringBuffer(); +void codegenInit() { + staticVariableBuffer = newStringBuffer(); + classInitBuffer = newStringBuffer(); currentMethodBuffer = 0; - finishedMethodsBuffer = newStringBuffer(); - mainBuffer = newStringBuffer(); - - stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); - sprintf(tempString, ".class public synchronized %s", className); - stringBufferAppend(mainBuffer, tempString); - stringBufferAppend(mainBuffer, ".super java/lang/Object"); - stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(mainBuffer, ""); - - stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); - stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); - stringBufferAppend(finishedMethodsBuffer, "\taload_0"); - stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); - stringBufferAppend(finishedMethodsBuffer, "\treturn"); - stringBufferAppend(finishedMethodsBuffer, ".end method"); - stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); - stringBufferAppend(finishedMethodsBuffer, ""); - - stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); - - stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); - stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); + finishedMethodsBuffer = newStringBuffer(); + mainBuffer = newStringBuffer(); + + stringBufferAppend(mainBuffer, "; ------- Header --------------------------------------------"); + sprintf(tempString, ".class public synchronized %s", className); + stringBufferAppend(mainBuffer, tempString); + stringBufferAppend(mainBuffer, ".super java/lang/Object"); + stringBufferAppend(mainBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(mainBuffer, ""); + + stringBufferAppend(finishedMethodsBuffer, "; ------- Constructor ---------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ".method public <init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit stack 1"); + stringBufferAppend(finishedMethodsBuffer, "\t.limit locals 1"); + stringBufferAppend(finishedMethodsBuffer, "\taload_0"); + stringBufferAppend(finishedMethodsBuffer, "\tinvokenonvirtual java/lang/Object/<init>()V"); + stringBufferAppend(finishedMethodsBuffer, "\treturn"); + stringBufferAppend(finishedMethodsBuffer, ".end method"); + stringBufferAppend(finishedMethodsBuffer, "; -----------------------------------------------------------"); + stringBufferAppend(finishedMethodsBuffer, ""); + + stringBufferAppend(staticVariableBuffer, "; ------- Class Variables -----------------------------------"); + + stringBufferAppend(classInitBuffer, "; ------- Class Initializer ---------------------------------"); + stringBufferAppend(classInitBuffer, ".method static <clinit>()V"); classInitBufferIndex = classInitBuffer->numberOfNextElement; - stringBufferAppend(classInitBuffer, "\t.limit locals 0"); - -} - -void codegenAppendCommand(char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); - increaseStackby(stackdiff); -} - -void codegenInsertCommand(int address, char* cmd, int stackdiff) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "\t%s", cmd); - if (global) stringBufferInsert(classInitBuffer, address, tempString); - else stringBufferInsert(currentMethodBuffer, address, tempString); - increaseStackby(stackdiff); -} - -void codegenAppendLabel(int label) { - char tempString[MAX_LENGTH_OF_COMMAND]; - sprintf(tempString, "Label%d:", label); - if (global) stringBufferAppend(classInitBuffer, tempString); - else stringBufferAppend(currentMethodBuffer, tempString); -}

    + stringBufferAppend(classInitBuffer, "\t.limit locals 0"); + +} + +void codegenAppendCommand(char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); + increaseStackby(stackdiff); +} + +void codegenInsertCommand(int address, char* cmd, int stackdiff) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "\t%s", cmd); + if (global) stringBufferInsert(classInitBuffer, address, tempString); + else stringBufferInsert(currentMethodBuffer, address, tempString); + increaseStackby(stackdiff); +} + +void codegenAppendLabel(int label) { + char tempString[MAX_LENGTH_OF_COMMAND]; + sprintf(tempString, "Label%d:", label); + if (global) stringBufferAppend(classInitBuffer, tempString); + else stringBufferAppend(currentMethodBuffer, tempString); +} diff --git a/diff.html b/diff.html index 16f76e6..8427a98 100644 --- a/diff.html +++ b/diff.html @@ -78,6 +78,10 @@

    Styles

    Default Style +
  • + + Dracula Style
  • +
  • Emacs Style
  • @@ -184,8 +188,6 @@

    Languages

  • HTML
  • -
  • JSON
  • - @@ -232,7 +234,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.abap_style()
    +  
    Makeup.Styles.HTML.StyleMap.abap_style()
     

    @@ -267,7 +269,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.algol_style()
    +  
    Makeup.Styles.HTML.StyleMap.algol_style()
     

    @@ -302,7 +304,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.algol_nu_style()
    +  
    Makeup.Styles.HTML.StyleMap.algol_nu_style()
     

    @@ -337,7 +339,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.arduino_style()
    +  
    Makeup.Styles.HTML.StyleMap.arduino_style()
     

    @@ -372,7 +374,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.autumn_style()
    +  
    Makeup.Styles.HTML.StyleMap.autumn_style()
     

    @@ -407,7 +409,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.borland_style()
    +  
    Makeup.Styles.HTML.StyleMap.borland_style()
     

    @@ -442,7 +444,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.bw_style()
    +  
    Makeup.Styles.HTML.StyleMap.bw_style()
     

    @@ -477,7 +479,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.colorful_style()
    +  
    Makeup.Styles.HTML.StyleMap.colorful_style()
     

    @@ -512,7 +514,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.default_style()
    +  
    Makeup.Styles.HTML.StyleMap.default_style()
     

    @@ -539,6 +541,41 @@

    \ No newline at end of file

    +

    + Dracula Style (dracula)¶ +

    + +

    + You can access this style as: +

    + +
    Makeup.Styles.HTML.StyleMap.dracula_style()
    +
    + +

    + And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you. +

    + + +

    + example¶ +

    + +
    index d332f34..b9fbaa5 100644
    +--- a/a.rtf
    ++++ b/b.rtf
    +@@ -6,5 +6,5 @@
    + \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
    + 
    + \f0\fs24 \cf0 Elixir\
    +-Erlang\
    +-Phoenix}
    +\ No newline at end of file
    ++erlang\
    ++Phoenix Framework}
    +\ No newline at end of file
    + +

    Emacs Style (emacs)¶

    @@ -547,7 +584,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.emacs_style()
    +  
    Makeup.Styles.HTML.StyleMap.emacs_style()
     

    @@ -582,7 +619,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.friendly_style()
    +  
    Makeup.Styles.HTML.StyleMap.friendly_style()
     

    @@ -617,7 +654,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.fruity_style()
    +  
    Makeup.Styles.HTML.StyleMap.fruity_style()
     

    @@ -652,7 +689,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.igor_style()
    +  
    Makeup.Styles.HTML.StyleMap.igor_style()
     

    @@ -687,7 +724,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.lovelace_style()
    +  
    Makeup.Styles.HTML.StyleMap.lovelace_style()
     

    @@ -722,7 +759,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.manni_style()
    +  
    Makeup.Styles.HTML.StyleMap.manni_style()
     

    @@ -757,7 +794,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.monokai_style()
    +  
    Makeup.Styles.HTML.StyleMap.monokai_style()
     

    @@ -792,7 +829,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.murphy_style()
    +  
    Makeup.Styles.HTML.StyleMap.murphy_style()
     

    @@ -827,7 +864,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.native_style()
    +  
    Makeup.Styles.HTML.StyleMap.native_style()
     

    @@ -862,7 +899,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.paraiso_dark_style()
    +  
    Makeup.Styles.HTML.StyleMap.paraiso_dark_style()
     

    @@ -897,7 +934,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.paraiso_light_style()
    +  
    Makeup.Styles.HTML.StyleMap.paraiso_light_style()
     

    @@ -932,7 +969,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.pastie_style()
    +  
    Makeup.Styles.HTML.StyleMap.pastie_style()
     

    @@ -967,7 +1004,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.perldoc_style()
    +  
    Makeup.Styles.HTML.StyleMap.perldoc_style()
     

    @@ -1002,7 +1039,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.rainbow_dash_style()
    +  
    Makeup.Styles.HTML.StyleMap.rainbow_dash_style()
     

    @@ -1037,7 +1074,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.rrt_style()
    +  
    Makeup.Styles.HTML.StyleMap.rrt_style()
     

    @@ -1072,7 +1109,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.tango_style()
    +  
    Makeup.Styles.HTML.StyleMap.tango_style()
     

    @@ -1107,7 +1144,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.trac_style()
    +  
    Makeup.Styles.HTML.StyleMap.trac_style()
     

    @@ -1142,7 +1179,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.vim_style()
    +  
    Makeup.Styles.HTML.StyleMap.vim_style()
     

    @@ -1177,7 +1214,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.vs_style()
    +  
    Makeup.Styles.HTML.StyleMap.vs_style()
     

    @@ -1212,7 +1249,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.xcode_style()
    +  
    Makeup.Styles.HTML.StyleMap.xcode_style()
     

    diff --git a/eex.html b/eex.html index 14d46b1..b8e34be 100644 --- a/eex.html +++ b/eex.html @@ -78,6 +78,10 @@

    Styles

    Default Style +
  • + + Dracula Style
  • +
  • Emacs Style
  • @@ -184,8 +188,6 @@

    Languages

  • HTML
  • -
  • JSON
  • - @@ -232,7 +234,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.abap_style()
    +  
    Makeup.Styles.HTML.StyleMap.abap_style()
     

    @@ -244,20 +246,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -268,7 +270,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.algol_style()
    +  
    Makeup.Styles.HTML.StyleMap.algol_style()
     

    @@ -280,20 +282,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -304,7 +306,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.algol_nu_style()
    +  
    Makeup.Styles.HTML.StyleMap.algol_nu_style()
     

    @@ -316,20 +318,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -340,7 +342,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.arduino_style()
    +  
    Makeup.Styles.HTML.StyleMap.arduino_style()
     

    @@ -352,20 +354,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -376,7 +378,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.autumn_style()
    +  
    Makeup.Styles.HTML.StyleMap.autumn_style()
     

    @@ -388,20 +390,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -412,7 +414,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.borland_style()
    +  
    Makeup.Styles.HTML.StyleMap.borland_style()
     

    @@ -424,20 +426,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -448,7 +450,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.bw_style()
    +  
    Makeup.Styles.HTML.StyleMap.bw_style()
     

    @@ -460,20 +462,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -484,7 +486,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.colorful_style()
    +  
    Makeup.Styles.HTML.StyleMap.colorful_style()
     

    @@ -496,20 +498,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -520,7 +522,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.default_style()
    +  
    Makeup.Styles.HTML.StyleMap.default_style()
     

    @@ -532,20 +534,56 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
    +<%# Comments - they are discarded from source %>
    +
    +<%= if true do %>
    +  It is obviously true
    +<% else %>
    +  This will never appear
    +<% end %>
    +
    +<%%= x + 3 %>
    +
    +<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    + + +

    + Dracula Style (dracula)¶ +

    + +

    + You can access this style as: +

    + +
    Makeup.Styles.HTML.StyleMap.dracula_style()
    +
    + +

    + And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you. +

    + + +

    + example.eex¶ +

    + +
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -556,7 +594,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.emacs_style()
    +  
    Makeup.Styles.HTML.StyleMap.emacs_style()
     

    @@ -568,20 +606,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -592,7 +630,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.friendly_style()
    +  
    Makeup.Styles.HTML.StyleMap.friendly_style()
     

    @@ -604,20 +642,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -628,7 +666,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.fruity_style()
    +  
    Makeup.Styles.HTML.StyleMap.fruity_style()
     

    @@ -640,20 +678,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -664,7 +702,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.igor_style()
    +  
    Makeup.Styles.HTML.StyleMap.igor_style()
     

    @@ -676,20 +714,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -700,7 +738,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.lovelace_style()
    +  
    Makeup.Styles.HTML.StyleMap.lovelace_style()
     

    @@ -712,20 +750,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -736,7 +774,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.manni_style()
    +  
    Makeup.Styles.HTML.StyleMap.manni_style()
     

    @@ -748,20 +786,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -772,7 +810,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.monokai_style()
    +  
    Makeup.Styles.HTML.StyleMap.monokai_style()
     

    @@ -784,20 +822,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -808,7 +846,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.murphy_style()
    +  
    Makeup.Styles.HTML.StyleMap.murphy_style()
     

    @@ -820,20 +858,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -844,7 +882,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.native_style()
    +  
    Makeup.Styles.HTML.StyleMap.native_style()
     

    @@ -856,20 +894,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -880,7 +918,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.paraiso_dark_style()
    +  
    Makeup.Styles.HTML.StyleMap.paraiso_dark_style()
     

    @@ -892,20 +930,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -916,7 +954,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.paraiso_light_style()
    +  
    Makeup.Styles.HTML.StyleMap.paraiso_light_style()
     

    @@ -928,20 +966,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -952,7 +990,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.pastie_style()
    +  
    Makeup.Styles.HTML.StyleMap.pastie_style()
     

    @@ -964,20 +1002,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -988,7 +1026,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.perldoc_style()
    +  
    Makeup.Styles.HTML.StyleMap.perldoc_style()
     

    @@ -1000,20 +1038,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -1024,7 +1062,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.rainbow_dash_style()
    +  
    Makeup.Styles.HTML.StyleMap.rainbow_dash_style()
     

    @@ -1036,20 +1074,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -1060,7 +1098,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.rrt_style()
    +  
    Makeup.Styles.HTML.StyleMap.rrt_style()
     

    @@ -1072,20 +1110,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -1096,7 +1134,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.tango_style()
    +  
    Makeup.Styles.HTML.StyleMap.tango_style()
     

    @@ -1108,20 +1146,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -1132,7 +1170,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.trac_style()
    +  
    Makeup.Styles.HTML.StyleMap.trac_style()
     

    @@ -1144,20 +1182,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -1168,7 +1206,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.vim_style()
    +  
    Makeup.Styles.HTML.StyleMap.vim_style()
     

    @@ -1180,20 +1218,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -1204,7 +1242,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.vs_style()
    +  
    Makeup.Styles.HTML.StyleMap.vs_style()
     

    @@ -1216,20 +1254,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>

    @@ -1240,7 +1278,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.xcode_style()
    +  
    Makeup.Styles.HTML.StyleMap.xcode_style()
     

    @@ -1252,20 +1290,20 @@

    example.eex¶

    -
    <% Elixir expression - inline with output %>
    -<%= Elixir expression - replace with result %>
    -<%% EEx quotation - returns the contents inside %>
    +    
    <% Elixir expression - inline with output %>
    +<%= Elixir expression - replace with result %>
    +<%% EEx quotation - returns the contents inside %>
     <%# Comments - they are discarded from source %>
     
    -<%= if true do %>
    +<%= if true do %>
       It is obviously true
    -<% else %>
    +<% else %>
       This will never appear
    -<% end %>
    +<% end %>
     
    -<%%= x + 3 %>
    +<%%= x + 3 %>
     
    -<%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    +
    <%= {:ok, v} = Access.fetch(assigns, :foo); v %>
    diff --git a/elixir.html b/elixir.html index aaee867..d1d109a 100644 --- a/elixir.html +++ b/elixir.html @@ -78,6 +78,10 @@

    Styles

    Default Style +
  • + + Dracula Style
  • +
  • Emacs Style
  • @@ -184,8 +188,6 @@

    Languages

  • HTML
  • -
  • JSON
  • - @@ -236,7 +238,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.abap_style()
    +  
    Makeup.Styles.HTML.StyleMap.abap_style()
     

    @@ -257,12 +259,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -273,19 +275,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -293,61 +295,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -365,7 +367,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -398,61 +400,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -460,20 +462,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -481,10 +483,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -496,27 +498,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -529,61 +531,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -591,18 +593,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -616,7 +618,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.algol_style()
    +  
    Makeup.Styles.HTML.StyleMap.algol_style()
     

    @@ -637,12 +639,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -653,19 +655,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -673,61 +675,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -745,7 +747,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -778,61 +780,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -840,20 +842,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -861,10 +863,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -876,27 +878,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -909,61 +911,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -971,18 +973,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -996,7 +998,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.algol_nu_style()
    +  
    Makeup.Styles.HTML.StyleMap.algol_nu_style()
     

    @@ -1017,12 +1019,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -1033,19 +1035,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -1053,61 +1055,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -1125,7 +1127,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -1158,61 +1160,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -1220,20 +1222,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -1241,10 +1243,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -1256,27 +1258,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -1289,61 +1291,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -1351,18 +1353,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -1376,7 +1378,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.arduino_style()
    +  
    Makeup.Styles.HTML.StyleMap.arduino_style()
     

    @@ -1397,12 +1399,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -1413,19 +1415,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -1433,61 +1435,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -1505,7 +1507,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -1538,61 +1540,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -1600,20 +1602,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -1621,10 +1623,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -1636,27 +1638,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -1669,61 +1671,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -1731,18 +1733,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -1756,7 +1758,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.autumn_style()
    +  
    Makeup.Styles.HTML.StyleMap.autumn_style()
     

    @@ -1777,12 +1779,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -1793,19 +1795,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -1813,61 +1815,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -1885,7 +1887,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -1918,61 +1920,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -1980,20 +1982,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -2001,10 +2003,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -2016,27 +2018,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -2049,61 +2051,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -2111,18 +2113,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -2136,7 +2138,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.borland_style()
    +  
    Makeup.Styles.HTML.StyleMap.borland_style()
     

    @@ -2157,12 +2159,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -2173,19 +2175,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -2193,61 +2195,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -2265,7 +2267,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -2298,61 +2300,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -2360,20 +2362,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -2381,10 +2383,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -2396,27 +2398,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -2429,61 +2431,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -2491,18 +2493,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -2516,7 +2518,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.bw_style()
    +  
    Makeup.Styles.HTML.StyleMap.bw_style()
     

    @@ -2537,12 +2539,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -2553,19 +2555,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -2573,61 +2575,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -2645,7 +2647,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -2678,61 +2680,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -2740,20 +2742,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -2761,10 +2763,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -2776,27 +2778,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -2809,61 +2811,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -2871,18 +2873,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -2896,7 +2898,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.colorful_style()
    +  
    Makeup.Styles.HTML.StyleMap.colorful_style()
     

    @@ -2917,12 +2919,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -2933,19 +2935,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -2953,61 +2955,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -3025,7 +3027,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -3058,61 +3060,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -3120,20 +3122,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -3141,10 +3143,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -3156,27 +3158,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -3189,61 +3191,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -3251,18 +3253,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -3276,7 +3278,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.default_style()
    +  
    Makeup.Styles.HTML.StyleMap.default_style()
     

    @@ -3297,12 +3299,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -3313,19 +3315,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -3333,61 +3335,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -3405,7 +3407,387 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} +?\x34 ; ?\xF + +# these show that only the first digit is part of the character +?\123 ; ?\12 ; ?\7 + +# Atoms +:this ; :that +:'complex atom' +:"with' \"\" 'quotes" +:" multi + line ' \s \123 \xff +atom" +:... ; :<<>> ; :%{} ; :% ; :{} +:++; :--; :*; :~~~; ::: +:% ; :. ; :<- + +# Strings +"Hello world" +"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes" +"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end" +"Multiline + string" + +# Char lists +'this is a list' +'escapes \' \t \\\'' +'Multiline + char + list +' + +# Binaries +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" + +# Sigils +~r/this + i\s "a" regex/ +~R'this + i\s "a" regex too' +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~W(hello #{no "123" \c\d \123 interpol} world)s + +~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } + +~S"No escapes \s\t\n and no #{interpolation}" + +:"atoms work #{"to" <> "o"}" + +# Operators +x = 1 + 2.0 * 3 +y = true and false; z = false or true +... = 144 +... == !x && y || z +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} + +# Free operators (added in 1.0.0) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) + +# Lists, tuples, maps, keywords +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] + +{:one, 2.0, "three"} + +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] + +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } + +# Comprehensions +for x <- 1..10, x < 5, do: {x, x} +pixels = "12345678" +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end + +# String interpolation +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" + +# Identifiers +abc_123 = 1 +_018OP = 2 +A__0 == 3 + +# Modules +defmodule Long.Module.Name do + @moduledoc "Simple module docstring" + + @doc """ + Multiline docstring + "with quotes" + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { + :tuple, + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } + """ + defstruct [:a, :name, :height] + + @doc ~S''' + No #{interpolation} of any kind. + \000 \x{ff} + + \n #{\x{ff}} + ''' + def func(a, b \\ []), do: :ok + + # Function + def f(x), do: x + # Operator definition (don't highlight the `x`!) + def x + y, do: nil + def x * y, do: nil + def x |> y, do: nil + def x && y, do: nil + def x || y, do: nil + # Word operators + def x and y, do: nil + def x or y, do: nil + def x in y, do: nil + # unquote, quote and unquote_splicing: + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil + # function name that starts with `quote`: + def quote_me(x), do: nil + + @doc false + def __before_compile__(_) do + :ok + end +end + +# Structs +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end + +# Types, pseudo-vars, attributes +defmodule M do + @custom_attr :some_constant + + @before_compile Long.Module.Name + + @typedoc "This is a type" + @type typ :: integer + + @typedoc """ + Another type + """ + @opaque typtyp :: 1..10 + + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do + a || b || :ok || :fail + Path.expand("..", __DIR__) + IO.inspect __ENV__ + __NOTAPSEUDOVAR__ = 11 + __MODULE__.func(b, a) + end + + defmacro m() do + __CALLER__ + end +end + +# Functions +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end + +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) + +# Function calls +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) +IO.ANSI.black + +# Control flow +if :this do + :that +else + :otherwise +end + +pid = self +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x + x when x in 1..12 -> -x +end + +cond do + false -> "too bad" + 4 > 5 -> "oops" + true -> nil +end + +# Lexical scope modifiers +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +alias Long.Module.Name, as: N0men123_and4 +use Bitwise + +4 &&& 5 +2 <<< 3 + +# Protocols +defprotocol Useless do + def func1(this) + def func2(that) +end + +defimpl Useless, for: Atom do +end + +# Exceptions +defmodule NotAnError do + defexception [:message] +end + +raise NotAnError, message: "This is not an error" +

    + + +

    + Dracula Style (dracula)¶ +

    + +

    + You can access this style as: +

    + +
    Makeup.Styles.HTML.StyleMap.dracula_style()
    +
    + +

    + And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you. +

    + + +

    + iex.exs¶ +

    + +
    # Normal IEx session
    +iex> 1+2
    +3
    +
    +iex> 1/0
    +** (ArithmeticError) bad argument in arithmetic expression
    +    :erlang./(1, 0)
    +
    +
    +iex> changeset = User.changeset(%User{}, %{})
    +#Ecto.Changeset<action: nil, changes: %{},
    +  errors: [name: {"can't be blank", [validation: :required]},
    +   email: {"can't be blank", [validation: :required]},
    +   bio: {"can't be blank", [validation: :required]}],
    +  data: #Hello.User<>, valid?: false>
    +
    +# Same as above, but with numbers:
    +iex(1)> 1+2
    +3
    +
    +iex(2)> 1/0
    +** (ArithmeticError) bad argument in arithmetic expression
    +    :erlang./(1, 0)
    +
    +
    +iex(3)> changeset = User.changeset(%User{}, %{})
    +#Ecto.Changeset<action: nil, changes: %{},
    +  errors: [name: {"can't be blank", [validation: :required]},
    +   email: {"can't be blank", [validation: :required]},
    +   bio: {"can't be blank", [validation: :required]}],
    +  data: #Hello.User<>, valid?: false>
    +
    + +

    + nesting.exs¶ +

    + +
    defmodule MyModule do
    +  @moduledoc """
    +  This is documentation for the module
    +  """
    +  
    +  @doc """
    +  This is documentation for the function
    +  """
    +  def f(x, y, z) do
    +    # Place the cursor over the delimiters (...), [...], etc.
    +    list = [x, y, z]
    +    tuple = {x, y, z}
    +    map = %{"x" => x, "y" => y, "z" => z}
    +    struct = %Long.Module.Name{x: x, y: y, z: y}
    +    << a::size(x), b::size(y), x::size(z) >> = "abcde"
    +    # Nested delimiters work too:
    +    nested = %{
    +      a: [x, y, z],
    +      b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}},
    +      c: %Long.Module.Name{
    +        x: x,
    +        y: y,
    +        z: << a::size(x), b::size(y) >>
    +      }
    +    }
    +  end
    +  # That's all, folks!
    +
    +  # The perfectly idiomatic Elixir code below is hard for mere humans to follow.
    +  # Maybe a little makeup can help you?
    +  # Place the cursor over the block keywords: do, else, catch, rescue after, end
    +  def g() do
    +    IO.inspect do
    +      "a"
    +    else
    +      IO.inspect do
    +        fn x -> x + 2 end # yes, it works on fn ... end too!
    +      else
    +        "b"
    +      catch
    +        if c do
    +          x
    +        else
    +          case y do
    +            1 -> if a do
    +                   b
    +                 else
    +                   c
    +                 end
    +            _ -> "Wow, we're deep now!"
    +          end
    +        end
    +      rescue
    +        "d"
    +      after
    +        "e"
    +      end
    +      "b"
    +    after
    +      "e"
    +    end
    +  end
    +end
    + +

    + sandbox.exs¶ +

    + +
    # Numbers
    +0b0101011
    +1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123
    +3.14 ; 5.0e21 ; 0.5e-12
    +100_000_000
    +
    +# these are not valid numbers
    +0b012 ; 0xboar ; 0o888
    +0B01 ; 0XAF ; 0O123
    +
    +# Characters
    +?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?,
    +?\x{12} ; ?\x{abcd}
     ?\x34 ; ?\xF
     
     # these show that only the first digit is part of the character
    @@ -3438,61 +3820,61 @@ 

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -3500,20 +3882,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -3521,10 +3903,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -3536,27 +3918,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -3569,61 +3951,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -3631,18 +4013,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -3656,7 +4038,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.emacs_style()
    +  
    Makeup.Styles.HTML.StyleMap.emacs_style()
     

    @@ -3677,12 +4059,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -3693,19 +4075,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -3713,61 +4095,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -3785,7 +4167,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -3818,61 +4200,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -3880,20 +4262,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -3901,10 +4283,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -3916,27 +4298,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -3949,61 +4331,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -4011,18 +4393,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -4036,7 +4418,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.friendly_style()
    +  
    Makeup.Styles.HTML.StyleMap.friendly_style()
     

    @@ -4057,12 +4439,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -4073,19 +4455,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -4093,61 +4475,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -4165,7 +4547,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -4198,61 +4580,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -4260,20 +4642,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -4281,10 +4663,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -4296,27 +4678,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -4329,61 +4711,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -4391,18 +4773,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -4416,7 +4798,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.fruity_style()
    +  
    Makeup.Styles.HTML.StyleMap.fruity_style()
     

    @@ -4437,12 +4819,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -4453,19 +4835,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -4473,61 +4855,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -4545,7 +4927,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -4578,61 +4960,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -4640,20 +5022,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -4661,10 +5043,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -4676,27 +5058,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -4709,61 +5091,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -4771,18 +5153,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -4796,7 +5178,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.igor_style()
    +  
    Makeup.Styles.HTML.StyleMap.igor_style()
     

    @@ -4817,12 +5199,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -4833,19 +5215,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -4853,61 +5235,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -4925,7 +5307,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -4958,61 +5340,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -5020,20 +5402,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -5041,10 +5423,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -5056,27 +5438,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -5089,61 +5471,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -5151,18 +5533,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -5176,7 +5558,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.lovelace_style()
    +  
    Makeup.Styles.HTML.StyleMap.lovelace_style()
     

    @@ -5197,12 +5579,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -5213,19 +5595,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -5233,61 +5615,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -5305,7 +5687,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -5338,61 +5720,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -5400,20 +5782,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -5421,10 +5803,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -5436,27 +5818,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -5469,61 +5851,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -5531,18 +5913,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -5556,7 +5938,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.manni_style()
    +  
    Makeup.Styles.HTML.StyleMap.manni_style()
     

    @@ -5577,12 +5959,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -5593,19 +5975,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -5613,61 +5995,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -5685,7 +6067,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -5718,61 +6100,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -5780,20 +6162,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -5801,10 +6183,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -5816,27 +6198,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -5849,61 +6231,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -5911,18 +6293,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -5936,7 +6318,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.monokai_style()
    +  
    Makeup.Styles.HTML.StyleMap.monokai_style()
     

    @@ -5957,12 +6339,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -5973,19 +6355,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -5993,61 +6375,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -6065,7 +6447,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -6098,61 +6480,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -6160,20 +6542,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -6181,10 +6563,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -6196,27 +6578,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -6229,61 +6611,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -6291,18 +6673,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -6316,7 +6698,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.murphy_style()
    +  
    Makeup.Styles.HTML.StyleMap.murphy_style()
     

    @@ -6337,12 +6719,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -6353,19 +6735,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -6373,61 +6755,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -6445,7 +6827,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -6478,61 +6860,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -6540,20 +6922,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -6561,10 +6943,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -6576,27 +6958,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -6609,61 +6991,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -6671,18 +7053,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -6696,7 +7078,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.native_style()
    +  
    Makeup.Styles.HTML.StyleMap.native_style()
     

    @@ -6717,12 +7099,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -6733,19 +7115,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -6753,61 +7135,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -6825,7 +7207,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -6858,61 +7240,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -6920,20 +7302,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -6941,10 +7323,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -6956,27 +7338,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -6989,61 +7371,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -7051,18 +7433,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -7076,7 +7458,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.paraiso_dark_style()
    +  
    Makeup.Styles.HTML.StyleMap.paraiso_dark_style()
     

    @@ -7097,12 +7479,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -7113,19 +7495,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -7133,61 +7515,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -7205,7 +7587,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -7238,61 +7620,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -7300,20 +7682,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -7321,10 +7703,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -7336,27 +7718,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -7369,61 +7751,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -7431,18 +7813,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -7456,7 +7838,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.paraiso_light_style()
    +  
    Makeup.Styles.HTML.StyleMap.paraiso_light_style()
     

    @@ -7477,12 +7859,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -7493,19 +7875,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -7513,61 +7895,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -7585,7 +7967,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -7618,61 +8000,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -7680,20 +8062,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -7701,10 +8083,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -7716,27 +8098,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -7749,61 +8131,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -7811,18 +8193,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -7836,7 +8218,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.pastie_style()
    +  
    Makeup.Styles.HTML.StyleMap.pastie_style()
     

    @@ -7857,12 +8239,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -7873,19 +8255,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -7893,61 +8275,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -7965,7 +8347,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -7998,61 +8380,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -8060,20 +8442,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -8081,10 +8463,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -8096,27 +8478,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -8129,61 +8511,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -8191,18 +8573,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -8216,7 +8598,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.perldoc_style()
    +  
    Makeup.Styles.HTML.StyleMap.perldoc_style()
     

    @@ -8237,12 +8619,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -8253,19 +8635,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -8273,61 +8655,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -8345,7 +8727,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -8378,61 +8760,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -8440,20 +8822,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -8461,10 +8843,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -8476,27 +8858,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -8509,61 +8891,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -8571,18 +8953,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -8596,7 +8978,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.rainbow_dash_style()
    +  
    Makeup.Styles.HTML.StyleMap.rainbow_dash_style()
     

    @@ -8617,12 +8999,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -8633,19 +9015,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -8653,61 +9035,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -8725,7 +9107,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -8758,61 +9140,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -8820,20 +9202,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -8841,10 +9223,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -8856,27 +9238,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -8889,61 +9271,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -8951,18 +9333,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -8976,7 +9358,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.rrt_style()
    +  
    Makeup.Styles.HTML.StyleMap.rrt_style()
     

    @@ -8997,12 +9379,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -9013,19 +9395,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -9033,61 +9415,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -9105,7 +9487,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -9138,61 +9520,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -9200,20 +9582,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -9221,10 +9603,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -9236,27 +9618,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -9269,61 +9651,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -9331,18 +9713,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -9356,7 +9738,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.tango_style()
    +  
    Makeup.Styles.HTML.StyleMap.tango_style()
     

    @@ -9377,12 +9759,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -9393,19 +9775,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -9413,61 +9795,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -9485,7 +9867,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -9518,61 +9900,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -9580,20 +9962,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -9601,10 +9983,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -9616,27 +9998,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -9649,61 +10031,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -9711,18 +10093,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -9736,7 +10118,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.trac_style()
    +  
    Makeup.Styles.HTML.StyleMap.trac_style()
     

    @@ -9757,12 +10139,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -9773,19 +10155,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -9793,61 +10175,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -9865,7 +10247,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -9898,61 +10280,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -9960,20 +10342,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -9981,10 +10363,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -9996,27 +10378,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -10029,61 +10411,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -10091,18 +10473,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -10116,7 +10498,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.vim_style()
    +  
    Makeup.Styles.HTML.StyleMap.vim_style()
     

    @@ -10137,12 +10519,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -10153,19 +10535,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -10173,61 +10555,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -10245,7 +10627,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -10278,61 +10660,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -10340,20 +10722,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -10361,10 +10743,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -10376,27 +10758,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -10409,61 +10791,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -10471,18 +10853,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -10496,7 +10878,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.vs_style()
    +  
    Makeup.Styles.HTML.StyleMap.vs_style()
     

    @@ -10517,12 +10899,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -10533,19 +10915,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -10553,61 +10935,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -10625,7 +11007,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -10658,61 +11040,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -10720,20 +11102,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -10741,10 +11123,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -10756,27 +11138,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -10789,61 +11171,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -10851,18 +11233,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    @@ -10876,7 +11258,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.xcode_style()
    +  
    Makeup.Styles.HTML.StyleMap.xcode_style()
     

    @@ -10897,12 +11279,12 @@

    :erlang./(1, 0) -iex> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false> # Same as above, but with numbers: iex(1)> 1+2 @@ -10913,19 +11295,19 @@

    :erlang./(1, 0) -iex(3)> changeset = User.changeset(%User{}, %{}) -#Ecto.Changeset<action: nil, changes: %{}, - errors: [name: {"can't be blank", [validation: :required]}, - email: {"can't be blank", [validation: :required]}, - bio: {"can't be blank", [validation: :required]}], - data: #Hello.User<>, valid?: false> +iex(3)> changeset = User.changeset(%User{}, %{}) +#Ecto.Changeset<action: nil, changes: %{}, + errors: [name: {"can't be blank", [validation: :required]}, + email: {"can't be blank", [validation: :required]}, + bio: {"can't be blank", [validation: :required]}], + data: #Hello.User<>, valid?: false>

    nesting.exs¶

    -
    defmodule MyModule do
    +    
    defmodule MyModule do
       @moduledoc """
       This is documentation for the module
       """
    @@ -10933,61 +11315,61 @@ 

    @doc """ This is documentation for the function """ - def f(x, y, z) do + def f(x, y, z) do # Place the cursor over the delimiters (...), [...], etc. - list = [x, y, z] - tuple = {x, y, z} - map = %{"x" => x, "y" => y, "z" => z} - struct = %Long.Module.Name{x: x, y: y, z: y} - << a::size(x), b::size(y), x::size(z) >> = "abcde" + list = [x, y, z] + tuple = {x, y, z} + map = %{"x" => x, "y" => y, "z" => z} + struct = %Long.Module.Name{x: x, y: y, z: y} + << a::size(x), b::size(y), x::size(z) >> = "abcde" # Nested delimiters work too: - nested = %{ - a: [x, y, z], - b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, - c: %Long.Module.Name{ + nested = %{ + a: [x, y, z], + b: {x, {x, y}, {x, {x, y}, {x, y, z, [x, y, z]}}}, + c: %Long.Module.Name{ x: x, y: y, - z: << a::size(x), b::size(y) >> - } - } - end + z: << a::size(x), b::size(y) >> + } + } + end # That's all, folks! # The perfectly idiomatic Elixir code below is hard for mere humans to follow. # Maybe a little makeup can help you? # Place the cursor over the block keywords: do, else, catch, rescue after, end - def g() do - IO.inspect do + def g() do + IO.inspect do "a" - else - IO.inspect do - fn x -> x + 2 end # yes, it works on fn ... end too! - else + else + IO.inspect do + fn x -> x + 2 end # yes, it works on fn ... end too! + else "b" - catch - if c do + catch + if c do x - else - case y do - 1 -> if a do + else + case y do + 1 -> if a do b - else + else c - end + end _ -> "Wow, we're deep now!" - end - end - rescue + end + end + rescue "d" - after + after "e" - end + end "b" - after + after "e" - end - end -end

    +
    end + end +end

    sandbox.exs¶ @@ -11005,7 +11387,7 @@

    # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, -?\x{12} ; ?\x{abcd} +?\x{12} ; ?\x{abcd} ?\x34 ; ?\xF # these show that only the first digit is part of the character @@ -11038,61 +11420,61 @@

    ' # Binaries -<<1, 2, 3>> -<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" +<<1, 2, 3>> +<<"hello"::binary, c :: utf8, x::[4, unit(2)]>> = "helloâ„¢1" # Sigils ~r/this + i\s "a" regex/ ~R'this + i\s "a" regex too' -~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s +~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s ~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } ~S"No escapes \s\t\n and no #{interpolation}" -:"atoms work #{"to" <> "o"}" +:"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 y = true and false; z = false or true ... = 144 ... == !x && y || z -"hello" |> String.upcase |> String.downcase() -{^z, a} = {true, x} +"hello" |> String.upcase |> String.downcase() +{^z, a} = {true, x} # Free operators (added in 1.0.0) -p ~>> f = bind(p, f) -p1 ~> p2 = pair_right(p1, p2) -p1 <~ p2 = pair_left(p1, p2) -p1 <~> p2 = pair_both(p1, p2) -p |~> f = map(p, f) -p1 <|> p2 = either(p1, p2) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) # Lists, tuples, maps, keywords -[1, :a, 'hello'] ++ [2, 3] -[:head | [?t, ?a, ?i, ?l]] +[1, :a, 'hello'] ++ [2, 3] +[:head | [?t, ?a, ?i, ?l]] -{:one, 2.0, "three"} +{:one, 2.0, "three"} -[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] -["this is an atom too": 1, "so is this": 2] -[option: "value", key: :word] -[++: "operator", ~~~: :&&&] +[...: "this", <<>>: "is", %{}: "a keyword", %: "list", {}: "too"] +["this is an atom too": 1, "so is this": 2] +[option: "value", key: :word] +[++: "operator", ~~~: :&&&] -map = %{shortcut: "syntax"} -%{map | "update" => "me"} -%{ 12 => 13, :weird => ['thing'] } +map = %{shortcut: "syntax"} +%{map | "update" => "me"} +%{ 12 => 13, :weird => ['thing'] } # Comprehensions -for x <- 1..10, x < 5, do: {x, x} +for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do - [r, {g, %{"b" => a}}] -end +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do + [r, {g, %{"b" => a}}] +end # String interpolation -"String #{inspect "interpolation"} is quite #{1+4+7} difficult" +"String #{inspect "interpolation"} is quite #{1+4+7} difficult" # Identifiers abc_123 = 1 @@ -11100,20 +11482,20 @@

    A__0 == 3 # Modules -defmodule Long.Module.Name do +defmodule Long.Module.Name do @moduledoc "Simple module docstring" @doc """ Multiline docstring "with quotes" - and #{ inspect %{"interpolation" => "in" <> "action"} } - now with #{ {:a, 'tuple'} } - and #{ inspect { + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { :tuple, - %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } - } } + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ - defstruct [:a, :name, :height] + defstruct [:a, :name, :height] @doc ~S''' No #{interpolation} of any kind. @@ -11121,10 +11503,10 @@

    \n #{\x{ff}} ''' - def func(a, b \\ []), do: :ok + def func(a, b \\ []), do: :ok # Function - def f(x), do: x + def f(x), do: x # Operator definition (don't highlight the `x`!) def x + y, do: nil def x * y, do: nil @@ -11136,27 +11518,27 @@

    def x or y, do: nil def x in y, do: nil # unquote, quote and unquote_splicing: - def quote(f)(x), do: nil - def unquote(f)(x), do: nil - def unquote_splicing(f)(x), do: nil + def quote(f)(x), do: nil + def unquote(f)(x), do: nil + def unquote_splicing(f)(x), do: nil # function name that starts with `quote`: - def quote_me(x), do: nil + def quote_me(x), do: nil @doc false - def __before_compile__(_) do + def __before_compile__(_) do :ok - end -end + end +end # Structs -defmodule Second.Module do - s = %Long.Module.Name{name: "Silly"} - %Long.Module.Name{s | height: {192, :cm}} - ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." -end +defmodule Second.Module do + s = %Long.Module.Name{name: "Silly"} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." +end # Types, pseudo-vars, attributes -defmodule M do +defmodule M do @custom_attr :some_constant @before_compile Long.Module.Name @@ -11169,61 +11551,61 @@

    """ @opaque typtyp :: 1..10 - @spec func(typ, typtyp) :: :ok | :fail - def func(a, b) do + @spec func(typ, typtyp) :: :ok | :fail + def func(a, b) do a || b || :ok || :fail - Path.expand("..", __DIR__) + Path.expand("..", __DIR__) IO.inspect __ENV__ __NOTAPSEUDOVAR__ = 11 - __MODULE__.func(b, a) - end + __MODULE__.func(b, a) + end - defmacro m() do + defmacro m() do __CALLER__ - end -end + end +end # Functions -anon = fn x, y, z -> - fn(a, b, c) -> - &(x + y - z * a / &1 + b + div(&2, c)) - end -end +anon = fn x, y, z -> + fn(a, b, c) -> + &(x + y - z * a / &1 + b + div(&2, c)) + end +end -&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) +&Set.put(&1, &2) ; & Set.put(&1, &2) ; &( Set.put(&1, &1) ) # Function calls -anon.(1, 2, 3); self; hd([1,2,3]) -Kernel.spawn(fn -> :ok end) +anon.(1, 2, 3); self; hd([1,2,3]) +Kernel.spawn(fn -> :ok end) IO.ANSI.black # Control flow -if :this do +if :this do :that -else +else :otherwise -end +end pid = self -receive do - {:EXIT, _} -> :done - {^pid, :_} -> nil - after 100 -> :no_luck -end - -case __ENV__.line do - x when is_integer(x) -> x +receive do + {:EXIT, _} -> :done + {^pid, :_} -> nil + after 100 -> :no_luck +end + +case __ENV__.line do + x when is_integer(x) -> x x when x in 1..12 -> -x -end +end -cond do +cond do false -> "too bad" 4 > 5 -> "oops" true -> nil -end +end # Lexical scope modifiers -import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] +import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] alias Long.Module.Name, as: N0men123_and4 use Bitwise @@ -11231,18 +11613,18 @@

    2 <<< 3 # Protocols -defprotocol Useless do - def func1(this) - def func2(that) -end +defprotocol Useless do + def func1(this) + def func2(that) +end -defimpl Useless, for: Atom do -end +defimpl Useless, for: Atom do +end # Exceptions -defmodule NotAnError do - defexception [:message] -end +defmodule NotAnError do + defexception [:message] +end raise NotAnError, message: "This is not an error"

    diff --git a/erlang.html b/erlang.html index 55496ff..2bbf4be 100644 --- a/erlang.html +++ b/erlang.html @@ -78,6 +78,10 @@

    Styles

    Default Style +
  • + + Dracula Style
  • +
  • Emacs Style
  • @@ -184,8 +188,6 @@

    Languages

  • HTML
  • -
  • JSON
  • - @@ -232,7 +234,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.abap_style()
    +  
    Makeup.Styles.HTML.StyleMap.abap_style()
     

    @@ -244,144 +246,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -393,7 +395,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.algol_style()
    +  
    Makeup.Styles.HTML.StyleMap.algol_style()
     

    @@ -405,144 +407,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -554,7 +556,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.algol_nu_style()
    +  
    Makeup.Styles.HTML.StyleMap.algol_nu_style()
     

    @@ -566,144 +568,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -715,7 +717,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.arduino_style()
    +  
    Makeup.Styles.HTML.StyleMap.arduino_style()
     

    @@ -727,144 +729,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -876,7 +878,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.autumn_style()
    +  
    Makeup.Styles.HTML.StyleMap.autumn_style()
     

    @@ -888,144 +890,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -1037,7 +1039,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.borland_style()
    +  
    Makeup.Styles.HTML.StyleMap.borland_style()
     

    @@ -1049,144 +1051,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -1198,7 +1200,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.bw_style()
    +  
    Makeup.Styles.HTML.StyleMap.bw_style()
     

    @@ -1210,144 +1212,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -1359,7 +1361,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.colorful_style()
    +  
    Makeup.Styles.HTML.StyleMap.colorful_style()
     

    @@ -1371,144 +1373,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -1520,7 +1522,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.default_style()
    +  
    Makeup.Styles.HTML.StyleMap.default_style()
     

    @@ -1532,144 +1534,305 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
    +    listen/1,
    +    handle_client/1,
    +    maintain_clients/1,
    +    start/1,
    +    stop/0,
    +    controller/1
    +]).
    +
    +-author("jerith").
    +
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +
    +-record(player, {name = none, socket, mode}).
    +
    +%% To allow incoming connections, we need to listen on a TCP port.
    +%% This is also the entry point for our server as a whole, so it
    +%% starts the client_manager process and gives it a name so the rest
    +%% of the code can get to it easily.
    +
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
    +
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +    receive
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
    +    end,
    +    maintain_clients(NewPlayers).
    +
    +%% find_player is a utility function to get a player record associated
    +%% with a particular socket out of the player list.
    +
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +    Player.
    +
    +%% delete_player returns the player list without the given player.  It
    +%% deletes the player from the list based on the socket rather than
    +%% the whole record because the list might hold a different version.
    +
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
    +
    +%% Sends an appropriate prompt to the player.  Currently the only
    +%% prompt we send is the initial "Name: " when the player connects.
    +
    +send_prompt(Player) ->
    +    case Player#player.mode of
    +        connect ->
    +            gen_tcp:send(Player#player.socket, "Name: ");
    +        active ->
    +            ok
    +    end.
    +
    +%% Sends the given data to all players in active mode.
    +
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
    +        Players
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +        ActivePlayers
    +    ),
    +    ok.
    +
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
    +            "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
    +
    +a_binary() ->
    +    <<100:16/integer, 16#7f>>.
    +
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
    +
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
    +
    +escape_sequences() ->
    +    [
    +        "\b\d\e\f\n\r\s\t\v\'\"\\",
    +        % octal
    +        "\1\12\123",
    +        % short hex
    +        "\x01",
    +        % long hex
    +        "\x{fff}",
    +        % control characters
    +        "\^a\^A"
    +    ].
    +
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
    +
    +%% pmap, just because it's cool.
    +
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
    +        receive
    +            {Pid, Result} ->
    +                Result
    +        end
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
    +         || X <- L
    +        ]
    +    ].
    +
    + + +

    + Dracula Style (dracula)¶ +

    + +

    + You can access this style as: +

    + +
    Makeup.Styles.HTML.StyleMap.dracula_style()
    +
    + +

    + And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you. +

    + + +

    + example.erl¶ +

    + +
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -1681,7 +1844,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.emacs_style()
    +  
    Makeup.Styles.HTML.StyleMap.emacs_style()
     

    @@ -1693,144 +1856,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -1842,7 +2005,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.friendly_style()
    +  
    Makeup.Styles.HTML.StyleMap.friendly_style()
     

    @@ -1854,144 +2017,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -2003,7 +2166,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.fruity_style()
    +  
    Makeup.Styles.HTML.StyleMap.fruity_style()
     

    @@ -2015,144 +2178,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -2164,7 +2327,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.igor_style()
    +  
    Makeup.Styles.HTML.StyleMap.igor_style()
     

    @@ -2176,144 +2339,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -2325,7 +2488,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.lovelace_style()
    +  
    Makeup.Styles.HTML.StyleMap.lovelace_style()
     

    @@ -2337,144 +2500,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -2486,7 +2649,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.manni_style()
    +  
    Makeup.Styles.HTML.StyleMap.manni_style()
     

    @@ -2498,144 +2661,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -2647,7 +2810,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.monokai_style()
    +  
    Makeup.Styles.HTML.StyleMap.monokai_style()
     

    @@ -2659,144 +2822,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -2808,7 +2971,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.murphy_style()
    +  
    Makeup.Styles.HTML.StyleMap.murphy_style()
     

    @@ -2820,144 +2983,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -2969,7 +3132,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.native_style()
    +  
    Makeup.Styles.HTML.StyleMap.native_style()
     

    @@ -2981,144 +3144,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -3130,7 +3293,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.paraiso_dark_style()
    +  
    Makeup.Styles.HTML.StyleMap.paraiso_dark_style()
     

    @@ -3142,144 +3305,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -3291,7 +3454,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.paraiso_light_style()
    +  
    Makeup.Styles.HTML.StyleMap.paraiso_light_style()
     

    @@ -3303,144 +3466,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -3452,7 +3615,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.pastie_style()
    +  
    Makeup.Styles.HTML.StyleMap.pastie_style()
     

    @@ -3464,144 +3627,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -3613,7 +3776,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.perldoc_style()
    +  
    Makeup.Styles.HTML.StyleMap.perldoc_style()
     

    @@ -3625,144 +3788,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -3774,7 +3937,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.rainbow_dash_style()
    +  
    Makeup.Styles.HTML.StyleMap.rainbow_dash_style()
     

    @@ -3786,144 +3949,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -3935,7 +4098,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.rrt_style()
    +  
    Makeup.Styles.HTML.StyleMap.rrt_style()
     

    @@ -3947,144 +4110,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -4096,7 +4259,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.tango_style()
    +  
    Makeup.Styles.HTML.StyleMap.tango_style()
     

    @@ -4108,144 +4271,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -4257,7 +4420,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.trac_style()
    +  
    Makeup.Styles.HTML.StyleMap.trac_style()
     

    @@ -4269,144 +4432,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -4418,7 +4581,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.vim_style()
    +  
    Makeup.Styles.HTML.StyleMap.vim_style()
     

    @@ -4430,144 +4593,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -4579,7 +4742,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.vs_style()
    +  
    Makeup.Styles.HTML.StyleMap.vs_style()
     

    @@ -4591,144 +4754,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    @@ -4740,7 +4903,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.xcode_style()
    +  
    Makeup.Styles.HTML.StyleMap.xcode_style()
     

    @@ -4752,144 +4915,144 @@

    example.erl¶

    -
    -module(test).
    --export([
    +    
    -module(test).
    +-export([
         listen/1,
         handle_client/1,
         maintain_clients/1,
         start/1,
         stop/0,
         controller/1
    -]).
    +]).
     
    --author("jerith").
    +-author("jerith").
     
    --define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
    +-define(TCP_OPTIONS, [list, {packet, 0}, {active, false}, {reuseaddr, true}]).
     
    --record(player, {name = none, socket, mode}).
    +-record(player, {name = none, socket, mode}).
     
     %% To allow incoming connections, we need to listen on a TCP port.
     %% This is also the entry point for our server as a whole, so it
     %% starts the client_manager process and gives it a name so the rest
     %% of the code can get to it easily.
     
    -listen(Port) ->
    -    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    -    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    -    do_accept(LSocket).
    +listen(Port) ->
    +    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    +    register(client_manager, spawn(?MODULE, maintain_clients, [[]])),
    +    do_accept(LSocket).
     
    -maintain_clients(Players) ->
    -    io:format("Players:~n", []),
    -    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
    +maintain_clients(Players) ->
    +    io:format("Players:~n", []),
    +    lists:foreach(fun(P) -> io:format(">>> ~w~n", [P]) end, Players),
         receive
    -        {connect, Socket} ->
    -            Player = #player{socket = Socket, mode = connect},
    -            send_prompt(Player),
    -            io:format("client connected: ~w~n", [Player]),
    -            NewPlayers = [Player | Players];
    -        {disconnect, Socket} ->
    -            Player = find_player(Socket, Players),
    -            io:format("client disconnected: ~w~n", [Player]),
    -            NewPlayers = lists:delete(Player, Players);
    -        {data, Socket, Data} ->
    -            Player = find_player(Socket, Players),
    -            NewPlayers = parse_data(Player, Players, Data),
    -            NewPlayer = find_player(Socket, NewPlayers),
    -            send_prompt(NewPlayer)
    +        {connect, Socket} ->
    +            Player = #player{socket = Socket, mode = connect},
    +            send_prompt(Player),
    +            io:format("client connected: ~w~n", [Player]),
    +            NewPlayers = [Player | Players];
    +        {disconnect, Socket} ->
    +            Player = find_player(Socket, Players),
    +            io:format("client disconnected: ~w~n", [Player]),
    +            NewPlayers = lists:delete(Player, Players);
    +        {data, Socket, Data} ->
    +            Player = find_player(Socket, Players),
    +            NewPlayers = parse_data(Player, Players, Data),
    +            NewPlayer = find_player(Socket, NewPlayers),
    +            send_prompt(NewPlayer)
         end,
    -    maintain_clients(NewPlayers).
    +    maintain_clients(NewPlayers).
     
     %% find_player is a utility function to get a player record associated
     %% with a particular socket out of the player list.
     
    -find_player(Socket, Players) ->
    -    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
    +find_player(Socket, Players) ->
    +    {value, Player} = lists:keysearch(Socket, #player.socket, Players),
         Player.
     
     %% delete_player returns the player list without the given player.  It
     %% deletes the player from the list based on the socket rather than
     %% the whole record because the list might hold a different version.
     
    -delete_player(Player, Players) ->
    -    lists:keydelete(Player#player.socket, #player.socket, Players).
    +delete_player(Player, Players) ->
    +    lists:keydelete(Player#player.socket, #player.socket, Players).
     
     %% Sends an appropriate prompt to the player.  Currently the only
     %% prompt we send is the initial "Name: " when the player connects.
     
    -send_prompt(Player) ->
    +send_prompt(Player) ->
         case Player#player.mode of
             connect ->
    -            gen_tcp:send(Player#player.socket, "Name: ");
    +            gen_tcp:send(Player#player.socket, "Name: ");
             active ->
                 ok
         end.
     
     %% Sends the given data to all players in active mode.
     
    -send_to_active(Prefix, Players, Data) ->
    -    ActivePlayers = lists:filter(
    -        fun(P) -> P#player.mode == active end,
    +send_to_active(Prefix, Players, Data) ->
    +    ActivePlayers = lists:filter(
    +        fun(P) -> P#player.mode == active end,
             Players
    -    ),
    -    lists:foreach(
    -        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
    +    ),
    +    lists:foreach(
    +        fun(P) -> gen_tcp:send(P#player.socket, Prefix ++ Data) end,
             ActivePlayers
    -    ),
    +    ),
         ok.
     
    -get_timestamp() ->
    -    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    -    lists:flatten(
    -        io_lib:format(
    +get_timestamp() ->
    +    {{Year, Month, Day}, {Hour, Min, Sec}} = erlang:universaltime(),
    +    lists:flatten(
    +        io_lib:format(
                 "~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
    -            [Year, Month, Day, Hour, Min, Sec]
    -        )
    -    ).
    +            [Year, Month, Day, Hour, Min, Sec]
    +        )
    +    ).
     
    -a_binary() ->
    +a_binary() ->
         <<100:16/integer, 16#7f>>.
     
    -a_list_comprehension() ->
    -    [X * 2 || X <- [1, 2, 3]].
    +a_list_comprehension() ->
    +    [X * 2 || X <- [1, 2, 3]].
     
    -a_map() ->
    -    M0 = #{a => 1, b => 2},
    -    M1 = M0#{b := 200}.
    +a_map() ->
    +    M0 = #{a => 1, b => 2},
    +    M1 = M0#{b := 200}.
     
    -escape_sequences() ->
    -    [
    +escape_sequences() ->
    +    [
             "\b\d\e\f\n\r\s\t\v\'\"\\",
             % octal
             "\1\12\123",
             % short hex
             "\x01",
             % long hex
    -        "\x{fff}",
    +        "\x{fff}",
             % control characters
             "\^a\^A"
    -    ].
    +    ].
     
    -map(Fun, [H | T]) ->
    -    [Fun(H) | map(Fun, T)];
    -map(Fun, []) ->
    -    [].
    +map(Fun, [H | T]) ->
    +    [Fun(H) | map(Fun, T)];
    +map(Fun, []) ->
    +    [].
     
     %% pmap, just because it's cool.
     
    -pmap(F, L) ->
    -    Parent = self(),
    -    [
    +pmap(F, L) ->
    +    Parent = self(),
    +    [
             receive
    -            {Pid, Result} ->
    +            {Pid, Result} ->
                     Result
             end
    -     || Pid <- [
    -            spawn(fun() ->
    -                Parent ! {self(), F(X)}
    -            end)
    +     || Pid <- [
    +            spawn(fun() ->
    +                Parent ! {self(), F(X)}
    +            end)
              || X <- L
    -        ]
    -    ].
    +        ]
    +    ].
     
    diff --git a/heex.html b/heex.html index 4e456a2..15dbfea 100644 --- a/heex.html +++ b/heex.html @@ -78,6 +78,10 @@

    Styles

    Default Style +
  • + + Dracula Style
  • +
  • Emacs Style
  • @@ -184,8 +188,6 @@

    Languages

  • HTML
  • -
  • JSON
  • - @@ -232,7 +234,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.abap_style()
    +  
    Makeup.Styles.HTML.StyleMap.abap_style()
     

    @@ -244,16 +246,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -264,7 +266,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.algol_style()
    +  
    Makeup.Styles.HTML.StyleMap.algol_style()
     

    @@ -276,16 +278,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -296,7 +298,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.algol_nu_style()
    +  
    Makeup.Styles.HTML.StyleMap.algol_nu_style()
     

    @@ -308,16 +310,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -328,7 +330,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.arduino_style()
    +  
    Makeup.Styles.HTML.StyleMap.arduino_style()
     

    @@ -340,16 +342,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -360,7 +362,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.autumn_style()
    +  
    Makeup.Styles.HTML.StyleMap.autumn_style()
     

    @@ -372,16 +374,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -392,7 +394,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.borland_style()
    +  
    Makeup.Styles.HTML.StyleMap.borland_style()
     

    @@ -404,16 +406,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -424,7 +426,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.bw_style()
    +  
    Makeup.Styles.HTML.StyleMap.bw_style()
     

    @@ -436,16 +438,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -456,7 +458,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.colorful_style()
    +  
    Makeup.Styles.HTML.StyleMap.colorful_style()
     

    @@ -468,16 +470,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -488,7 +490,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.default_style()
    +  
    Makeup.Styles.HTML.StyleMap.default_style()
     

    @@ -500,16 +502,48 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
    +
    +<%= for user <- Repo.all(User) do %>
    +  <%= user.name %>
    +<% end %>
    + + +

    + Dracula Style (dracula)¶ +

    + +

    + You can access this style as: +

    + +
    Makeup.Styles.HTML.StyleMap.dracula_style()
    +
    + +

    + And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you. +

    + + +

    + example.heex¶ +

    + +
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -520,7 +554,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.emacs_style()
    +  
    Makeup.Styles.HTML.StyleMap.emacs_style()
     

    @@ -532,16 +566,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -552,7 +586,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.friendly_style()
    +  
    Makeup.Styles.HTML.StyleMap.friendly_style()
     

    @@ -564,16 +598,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -584,7 +618,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.fruity_style()
    +  
    Makeup.Styles.HTML.StyleMap.fruity_style()
     

    @@ -596,16 +630,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -616,7 +650,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.igor_style()
    +  
    Makeup.Styles.HTML.StyleMap.igor_style()
     

    @@ -628,16 +662,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -648,7 +682,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.lovelace_style()
    +  
    Makeup.Styles.HTML.StyleMap.lovelace_style()
     

    @@ -660,16 +694,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -680,7 +714,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.manni_style()
    +  
    Makeup.Styles.HTML.StyleMap.manni_style()
     

    @@ -692,16 +726,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -712,7 +746,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.monokai_style()
    +  
    Makeup.Styles.HTML.StyleMap.monokai_style()
     

    @@ -724,16 +758,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -744,7 +778,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.murphy_style()
    +  
    Makeup.Styles.HTML.StyleMap.murphy_style()
     

    @@ -756,16 +790,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -776,7 +810,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.native_style()
    +  
    Makeup.Styles.HTML.StyleMap.native_style()
     

    @@ -788,16 +822,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -808,7 +842,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.paraiso_dark_style()
    +  
    Makeup.Styles.HTML.StyleMap.paraiso_dark_style()
     

    @@ -820,16 +854,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -840,7 +874,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.paraiso_light_style()
    +  
    Makeup.Styles.HTML.StyleMap.paraiso_light_style()
     

    @@ -852,16 +886,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -872,7 +906,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.pastie_style()
    +  
    Makeup.Styles.HTML.StyleMap.pastie_style()
     

    @@ -884,16 +918,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -904,7 +938,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.perldoc_style()
    +  
    Makeup.Styles.HTML.StyleMap.perldoc_style()
     

    @@ -916,16 +950,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -936,7 +970,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.rainbow_dash_style()
    +  
    Makeup.Styles.HTML.StyleMap.rainbow_dash_style()
     

    @@ -948,16 +982,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -968,7 +1002,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.rrt_style()
    +  
    Makeup.Styles.HTML.StyleMap.rrt_style()
     

    @@ -980,16 +1014,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -1000,7 +1034,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.tango_style()
    +  
    Makeup.Styles.HTML.StyleMap.tango_style()
     

    @@ -1012,16 +1046,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -1032,7 +1066,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.trac_style()
    +  
    Makeup.Styles.HTML.StyleMap.trac_style()
     

    @@ -1044,16 +1078,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -1064,7 +1098,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.vim_style()
    +  
    Makeup.Styles.HTML.StyleMap.vim_style()
     

    @@ -1076,16 +1110,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -1096,7 +1130,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.vs_style()
    +  
    Makeup.Styles.HTML.StyleMap.vs_style()
     

    @@ -1108,16 +1142,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>

    @@ -1128,7 +1162,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.xcode_style()
    +  
    Makeup.Styles.HTML.StyleMap.xcode_style()
     

    @@ -1140,16 +1174,16 @@

    example.heex¶

    -
    <h1><%= expand_title(@title) %></h1>
    -<div id={"user_#{@user.id}"}>
    -  <%= @user.name %>
    -</div>
    -<%= render "child_template.html", assigns %>
    -<.show_name name={@user.name} />
    +    
    <h1><%= expand_title(@title) %></h1>
    +<div id={"user_#{@user.id}"}>
    +  <%= @user.name %>
    +</div>
    +<%= render "child_template.html", assigns %>
    +<.show_name name={@user.name} />
     
    -<%= for user <- Repo.all(User) do %>
    -  <%= user.name %>
    -<% end %>
    +
    <%= for user <- Repo.all(User) do %> + <%= user.name %> +<% end %>
    diff --git a/html.html b/html.html index b786599..0e761aa 100644 --- a/html.html +++ b/html.html @@ -78,6 +78,10 @@

    Styles

    Default Style +
  • + + Dracula Style
  • +
  • Emacs Style
  • @@ -184,8 +188,6 @@

    Languages

  • HTML
  • -
  • JSON
  • - @@ -232,7 +234,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.abap_style()
    +  
    Makeup.Styles.HTML.StyleMap.abap_style()
     

    @@ -245,25 +247,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -274,7 +276,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.algol_style()
    +  
    Makeup.Styles.HTML.StyleMap.algol_style()
     

    @@ -287,25 +289,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -316,7 +318,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.algol_nu_style()
    +  
    Makeup.Styles.HTML.StyleMap.algol_nu_style()
     

    @@ -329,25 +331,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -358,7 +360,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.arduino_style()
    +  
    Makeup.Styles.HTML.StyleMap.arduino_style()
     

    @@ -371,25 +373,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -400,7 +402,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.autumn_style()
    +  
    Makeup.Styles.HTML.StyleMap.autumn_style()
     

    @@ -413,25 +415,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -442,7 +444,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.borland_style()
    +  
    Makeup.Styles.HTML.StyleMap.borland_style()
     

    @@ -455,25 +457,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -484,7 +486,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.bw_style()
    +  
    Makeup.Styles.HTML.StyleMap.bw_style()
     

    @@ -497,25 +499,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -526,7 +528,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.colorful_style()
    +  
    Makeup.Styles.HTML.StyleMap.colorful_style()
     

    @@ -539,25 +541,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -568,7 +570,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.default_style()
    +  
    Makeup.Styles.HTML.StyleMap.default_style()
     

    @@ -581,25 +583,67 @@

    <!DOCTYPE html>
    -<html>
    +<html>
    +
    +<head>
    +  <title>Page Title</title>
    +</head>
    +
    +<body>
    +
    +  <h1 class="header">This is a Heading</h1>
    +
    +  <h2 class="header">This is a Subheading</h2>
    +
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
    +
    +</body>
    +
    +</html>
    + + +

    + Dracula Style (dracula)¶ +

    + +

    + You can access this style as: +

    + +
    Makeup.Styles.HTML.StyleMap.dracula_style()
    +
    + +

    + And invoke Makeup.stylesheet(style) to generate the appropriate stylesheets for you. +

    + + +

    + small.html¶ +

    + +
    <!DOCTYPE html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -610,7 +654,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.emacs_style()
    +  
    Makeup.Styles.HTML.StyleMap.emacs_style()
     

    @@ -623,25 +667,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -652,7 +696,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.friendly_style()
    +  
    Makeup.Styles.HTML.StyleMap.friendly_style()
     

    @@ -665,25 +709,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -694,7 +738,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.fruity_style()
    +  
    Makeup.Styles.HTML.StyleMap.fruity_style()
     

    @@ -707,25 +751,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -736,7 +780,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.igor_style()
    +  
    Makeup.Styles.HTML.StyleMap.igor_style()
     

    @@ -749,25 +793,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -778,7 +822,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.lovelace_style()
    +  
    Makeup.Styles.HTML.StyleMap.lovelace_style()
     

    @@ -791,25 +835,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -820,7 +864,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.manni_style()
    +  
    Makeup.Styles.HTML.StyleMap.manni_style()
     

    @@ -833,25 +877,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -862,7 +906,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.monokai_style()
    +  
    Makeup.Styles.HTML.StyleMap.monokai_style()
     

    @@ -875,25 +919,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -904,7 +948,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.murphy_style()
    +  
    Makeup.Styles.HTML.StyleMap.murphy_style()
     

    @@ -917,25 +961,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -946,7 +990,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.native_style()
    +  
    Makeup.Styles.HTML.StyleMap.native_style()
     

    @@ -959,25 +1003,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -988,7 +1032,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.paraiso_dark_style()
    +  
    Makeup.Styles.HTML.StyleMap.paraiso_dark_style()
     

    @@ -1001,25 +1045,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -1030,7 +1074,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.paraiso_light_style()
    +  
    Makeup.Styles.HTML.StyleMap.paraiso_light_style()
     

    @@ -1043,25 +1087,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -1072,7 +1116,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.pastie_style()
    +  
    Makeup.Styles.HTML.StyleMap.pastie_style()
     

    @@ -1085,25 +1129,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -1114,7 +1158,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.perldoc_style()
    +  
    Makeup.Styles.HTML.StyleMap.perldoc_style()
     

    @@ -1127,25 +1171,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -1156,7 +1200,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.rainbow_dash_style()
    +  
    Makeup.Styles.HTML.StyleMap.rainbow_dash_style()
     

    @@ -1169,25 +1213,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -1198,7 +1242,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.rrt_style()
    +  
    Makeup.Styles.HTML.StyleMap.rrt_style()
     

    @@ -1211,25 +1255,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -1240,7 +1284,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.tango_style()
    +  
    Makeup.Styles.HTML.StyleMap.tango_style()
     

    @@ -1253,25 +1297,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -1282,7 +1326,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.trac_style()
    +  
    Makeup.Styles.HTML.StyleMap.trac_style()
     

    @@ -1295,25 +1339,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -1324,7 +1368,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.vim_style()
    +  
    Makeup.Styles.HTML.StyleMap.vim_style()
     

    @@ -1337,25 +1381,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -1366,7 +1410,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.vs_style()
    +  
    Makeup.Styles.HTML.StyleMap.vs_style()
     

    @@ -1379,25 +1423,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>

    @@ -1408,7 +1452,7 @@

    You can access this style as:

    -
    Makeup.Styles.HTML.StyleMap.xcode_style()
    +  
    Makeup.Styles.HTML.StyleMap.xcode_style()
     

    @@ -1421,25 +1465,25 @@

    <!DOCTYPE html>
    -<html>
    +<html>
     
    -<head>
    -  <title>Page Title</title>
    -</head>
    +<head>
    +  <title>Page Title</title>
    +</head>
     
    -<body>
    +<body>
     
    -  <h1 class="header">This is a Heading</h1>
    +  <h1 class="header">This is a Heading</h1>
     
    -  <h2 class="header">This is a Subheading</h2>
    +  <h2 class="header">This is a Subheading</h2>
     
    -  <p>
    -    This <em>is</em> a paragraph.
    -    It contains <strong>several</strong> sentences</p>
    +  <p>
    +    This <em>is</em> a paragraph.
    +    It contains <strong>several</strong> sentences</p>
     
    -</body>
    +</body>
     
    -</html>
    +
    </html>
    diff --git a/index.html b/index.html index f8c2af5..40974d5 100644 --- a/index.html +++ b/index.html @@ -57,8 +57,6 @@

    Languages

  • HTML
  • -
  • JSON
  • - @@ -144,15 +142,6 @@

    HTML -
  • - -
    - -
    -
    - JSON -
  • -

    diff --git a/static/css/makeup.css b/static/css/makeup.css index 0888a8f..e8aeb7b 100644 --- a/static/css/makeup.css +++ b/static/css/makeup.css @@ -591,6 +591,79 @@ .highlight-default .vi {color: #19177C; } /* :name_variable_instance */ .highlight-default .vm {color: #19177C; } /* :name_variable_magic */ +.highlight-dracula .hll {background-color: #44475A} +.highlight-dracula {background-color: #282a36}.highlight-dracula .unselectable { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.highlight-dracula .bp {color: #6272A4; } /* :name_builtin_pseudo */ +.highlight-dracula .c {color: #6272A4; } /* :comment */ +.highlight-dracula .c1 {color: #6272A4; } /* :comment_single */ +.highlight-dracula .ch {color: #6272A4; } /* :comment_hashbang */ +.highlight-dracula .cm {color: #6272A4; } /* :comment_multiline */ +.highlight-dracula .cp {color: #6272A4; } /* :comment_preproc */ +.highlight-dracula .cpf {color: #6272A4; } /* :comment_preproc_file */ +.highlight-dracula .cs {color: #6272A4; } /* :comment_special */ +.highlight-dracula .dl {color: #F1FA8C; } /* :string_delimiter */ +.highlight-dracula .fm {color: #50FA7B; } /* :name_function_magic */ +.highlight-dracula .gp {color: #6272A4; font-weight: bold; } /* :generic_prompt */ +.highlight-dracula .gt {color: #FFB86C; } /* :generic_traceback */ +.highlight-dracula .il {color: #BD93F9; } /* :number_integer_long */ +.highlight-dracula .k {color: #FF92DF; } /* :keyword */ +.highlight-dracula .kc {color: #FF92DF; } /* :keyword_constant */ +.highlight-dracula .kd {color: #FF92DF; } /* :keyword_declaration */ +.highlight-dracula .kn {color: #FF92DF; } /* :keyword_namespace */ +.highlight-dracula .kp {color: #FF92DF; } /* :keyword_pseudo */ +.highlight-dracula .kr {color: #FF92DF; } /* :keyword_reserved */ +.highlight-dracula .kt {color: #FF92DF; } /* :keyword_type */ +.highlight-dracula .m {color: #BD93F9; } /* :number */ +.highlight-dracula .mb {color: #BD93F9; } /* :number_bin */ +.highlight-dracula .mf {color: #BD93F9; } /* :number_float */ +.highlight-dracula .mh {color: #BD93F9; } /* :number_hex */ +.highlight-dracula .mi {color: #BD93F9; } /* :number_integer */ +.highlight-dracula .mo {color: #BD93F9; } /* :number_oct */ +.highlight-dracula .n {color: #50FA7B; } /* :name */ +.highlight-dracula .na {color: #BD93F9; } /* :name_attribute */ +.highlight-dracula .nb {color: #50FA7B; } /* :name_builtin */ +.highlight-dracula .nc {color: #A4FFFF; } /* :name_class */ +.highlight-dracula .nd {color: #50FA7B; } /* :name_decorator */ +.highlight-dracula .ne {color: #50FA7B; } /* :name_exception */ +.highlight-dracula .nf {color: #50FA7B; } /* :name_function */ +.highlight-dracula .ni {color: #50FA7B; } /* :name_entity */ +.highlight-dracula .nl {color: #50FA7B; } /* :name_label */ +.highlight-dracula .nn {color: #50FA7B; } /* :name_namespace */ +.highlight-dracula .no {color: #BD93F9; } /* :name_constant */ +.highlight-dracula .nt {color: #50FA7B; } /* :name_tag */ +.highlight-dracula .nv {color: #50FA7B; } /* :name_variable */ +.highlight-dracula .nx {color: #50FA7B; } /* :name_other */ +.highlight-dracula .o {color: #FF92DF; } /* :operator */ +.highlight-dracula .ow {color: #FF92DF; } /* :operator_word */ +.highlight-dracula .p {color: #F8F8F2; } /* :punctuation */ +.highlight-dracula .py {color: #50FA7B; } /* :name_property */ +.highlight-dracula .s {color: #F1FA8C; } /* :string */ +.highlight-dracula .s1 {color: #F1FA8C; } /* :string_single */ +.highlight-dracula .s2 {color: #F1FA8C; } /* :string_double */ +.highlight-dracula .sa {color: #F1FA8C; } /* :string_affix */ +.highlight-dracula .sb {color: #F1FA8C; } /* :string_backtick */ +.highlight-dracula .sc {color: #F1FA8C; } /* :string_char */ +.highlight-dracula .sd {color: #F1FA8C; } /* :string_doc */ +.highlight-dracula .se {color: #F1FA8C; } /* :string_escape */ +.highlight-dracula .sh {color: #F1FA8C; } /* :string_heredoc */ +.highlight-dracula .si {color: #F1FA8C; } /* :string_interpol */ +.highlight-dracula .sr {color: #F1FA8C; } /* :string_regex */ +.highlight-dracula .ss {color: #FFB86C; } /* :string_symbol */ +.highlight-dracula .sx {color: #F1FA8C; } /* :string_other */ +.highlight-dracula .sx {color: #F1FA8C; } /* :string_sigil */ +.highlight-dracula .vc {color: #50FA7B; } /* :name_variable_class */ +.highlight-dracula .vg {color: #50FA7B; } /* :name_variable_global */ +.highlight-dracula .vi {color: #50FA7B; } /* :name_variable_instance */ +.highlight-dracula .vm {color: #50FA7B; } /* :name_variable_magic */ + .highlight-emacs .hll {background-color: #ffffcc} .highlight-emacs {background-color: #f8f8f8}.highlight-emacs .unselectable { -webkit-touch-callout: none;