vile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vile] Disappearing quotes in macro parameters


From: Jānis Rūcis
Subject: [vile] Disappearing quotes in macro parameters
Date: Thu, 14 Aug 2008 08:22:12 +0300
User-agent: Mutt/1.5.18 (2008-05-17)

Hi,

I noticed a problem with handling quotes in macro parameters while
trying to pass a value enclosed in single-quotes interactively to a
macro.  I wrote some (simple but rather verbose) code to demonstrate
it:

    store-procedure write-first-param string
        write-message $1
    ~endm

    write-message "-- no quotes"

    write-first-param "one two three"
    write-first-param 'one two three'
    write-first-param one\ two\ three

    write-message "-- double quotes"

    write-first-param "\"one two three\""
    write-first-param "\"one\" two three"
    write-first-param "one \"two\" three"
    write-first-param "one two \"three\""

    write-message "-- single quotes"

    write-first-param "'one two three'"
    write-first-param "'one' two three"
    write-first-param "one 'two' three"
    write-first-param "one two 'three'"

    write-message "-- escaped single-quotes"

    write-first-param \'one\ two\ three\'
    write-first-param \'one\'\ two\ three
    write-first-param one\ \'two\'\ three
    write-first-param one\ two\ \'three\'

Running the code results in this output:

    -- no quotes
    one two three
    one two three
    one two three
    -- double quotes
    one two three
    one two three
    one "two" three
    one two "three"
    -- single quotes
    one two three
    one two three
    one 'two' three
    one two 'three'
    -- escaped single-quotes
    one two three'
    one' two three
    one 'two' three
    one two 'three'

Generally, whenever a value begins with a quote, it's handled in a
strange way.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]