Syntax highlighting using Mediawiki formatting: Difference between revisions
Syntax highlighting using Mediawiki formatting (view source)
Revision as of 18:26, 11 October 2023
, 8 months ago→{{header|AWK}}: Tweak
(→{{header|Wren}}: Now allows for nesting of multi-line comments.) |
(→{{header|AWK}}: Tweak) |
||
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 == "\\" )
{
nextChar();▼
}
}
'''while'''( c != "\"" && c != "" );
Line 246 ⟶ 243:
''# pattern''
bracketDepth = 0;
'''while'''( c != "" && ( c != "/" || bracketDepth > 0 ) )
{
'''if'''( c == "\\" || c == "[" )
{
'''if'''
{
bracketDepth ++;
}
}
'''else''' '''if'''( c == "]" )
Line 263 ⟶ 258:
bracketDepth --;
}
}
'''if'''( c != "/" )
Line 295 ⟶ 289:
{
''# something else''
}
}
Line 303 ⟶ 296:
printf( "\n" );
}
'''function''' outAndNextChar()
{
printf( "%s", c );
}
Line 315 ⟶ 314:
{
''# at end of line''
}
'''else'''
|