[PATCH] vbscript: Support date and time literals.

Jacek Caban jacek at codeweavers.com
Wed Sep 8 13:15:50 CDT 2021


Hi Robert,

On 9/7/21 9:27 PM, Robert Wilhelm wrote:
> +static int parse_date_literal(parser_ctx_t *ctx, const WCHAR **ret)
> +{
> +    const WCHAR *ptr = ++ctx->ptr;
> +    WCHAR *rptr;
> +    int len = 0;
> +
> +    while(ctx->ptr < ctx->end) {
> +        if(*ctx->ptr == '\n' || *ctx->ptr == '\r') {
> +            FIXME("newline inside date literal\n");
> +            return 0;
> +        }
> +
> +       if(*ctx->ptr == '#')
> +            break;
> +       ctx->ptr++;
> +    }
> +
> +    if(ctx->ptr == ctx->end) {
> +        FIXME("unterminated date literal\n");
> +        return 0;
> +    }
> +
> +    len += ctx->ptr-ptr;
> +
> +    *ret = rptr = parser_alloc(ctx, (len+1)*sizeof(WCHAR));
> +    if(!rptr)
> +        return 0;
> +
> +    while(ptr < ctx->ptr) {
> +        *rptr++ = *ptr++;
> +    }
> +
> +    *rptr = 0;
> +    ctx->ptr++;
> +    return tDate;
> +}


I think that the conversion should happen here. For example with the 
attached test, native fails parsing early and never reaches the first 
trace. We may pass converted date down the pipe.


Thanks,

Jacek

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.vbs
Type: application/x-wine-extension-vbs
Size: 60 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20210908/735e5cfc/attachment.bin>


More information about the wine-devel mailing list