Jump to content

Syntax highlighting using Mediawiki formatting: Difference between revisions

(→‎{{header|Wren}}: Now allows for nesting of multi-line comments.)
Line 183:
'''BEGIN''' \
{
''# reserved word list as in gawk and treating getline as reserved ''
kw = "BEGIN/BEGINFILE/END/ENDFILE/" \
Line 197 ⟶ 196:
} ''# BEGIN''
{
{
printf( " " );
line = $0;
Line 225 ⟶ 224:
'''if'''( c == "\\" )
{
printfoutAndNextChar( "%s", c );
nextChar();
}
printfoutAndNextChar( "%s", c );
nextChar();
}
'''while'''( c != "\"" && c != "" );
Line 246 ⟶ 243:
''# pattern''
bracketDepth = 0;
printfoutAndNextChar( "%s", c );
nextChar();
'''while'''( c != "" && ( c != "/" || bracketDepth > 0 ) )
{
'''if'''( c == "\\" || c == "[" )
{
'''if''' ( c == "[" )
{
bracketDepth ++;
}
printfoutAndNextChar( "%s", c );
nextChar();
}
'''else''' '''if'''( c == "]" )
Line 263 ⟶ 258:
bracketDepth --;
}
printfoutAndNextChar( "%s", c );
nextChar();
}
'''if'''( c != "/" )
Line 295 ⟶ 289:
{
''# something else''
printfoutAndNextChar( "%s", c );
nextChar();
}
}
Line 303 ⟶ 296:
printf( "\n" );
}
'''function''' outAndNextChar()
{
printf( "%s", c );
nextChar();
}
Line 315 ⟶ 314:
{
''# at end of line''
c lastC = c = "";
}
'''else'''
3,048

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.