Syntax highlighting using Mediawiki formatting: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: nested block comments)
Line 384: Line 384:
'''constant''' qqq = `""`&`"`, ''/* (split to assist with permitting ^^^) */''
'''constant''' qqq = `""`&`"`, ''/* (split to assist with permitting ^^^) */''
keywords = {`and`,`assert`,`bool`,`command_line`,`constant`,`do`,`else`,`elsif`,`end`,
keywords = {`and`,`assert`,`bool`,`command_line`,`constant`,`do`,`else`,`elsif`,`end`,
`find`,`for`,`function`,`get_text`,`if`,`in`,`integer`,`length`,`match`,`not`,
`find`,`for`,`function`,`get_text`,`if`,`iff`,`in`,`integer`,`length`,`match`,`not`,
`procedure`,`puts`,`return`,`sequence`,`string`,`substitute`,`then`,`wait_key`,`while`},
`procedure`,`puts`,`return`,`sequence`,`string`,`substitute`,`then`,`wait_key`,`while`},
htmlify = {"'&<>",{`apos`,`amp`,`lt`,`gt`}}
htmlify = {"'&<>",{`apos`,`amp`,`lt`,`gt`}}
Line 427: Line 427:
out &= `''`
out &= `''`
'''elsif''' ch='/' '''and''' i<l '''and''' pgm[i+1]='*' '''then'''
'''elsif''' ch='/' '''and''' i<l '''and''' pgm[i+1]='*' '''then'''
''-- nb: does not handle nested block comments''
'''integer''' block_comment = i
'''integer''' block_comment = i
i = '''match'''(`*/`,pgm,i+2)+1
i = '''match'''(`*/`,pgm,i+2)+1
Line 440: Line 441:
'''end''' '''if'''
'''end''' '''if'''
'''elsif''' '''find'''(ch,"`'") '''then'''
'''elsif''' '''find'''(ch,"`'") '''then'''
'''string''' stype = iff(ch='`'?"backtick":"single")
'''string''' stype = '''iff'''(ch='`'?"backtick":"single")
i = do_string(i,'''find'''(ch,pgm,i+1),0,stype)
i = do_string(i,'''find'''(ch,pgm,i+1),0,stype)
'''else'''
'''else'''