<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>26270</bug_id>
          
          <creation_ts>2014-07-05 10:55:39 +0000</creation_ts>
          <short_desc>produce tokens for &quot;/*&quot; and &quot;*/&quot;, or define an unclosed comment as a parse error</short_desc>
          <delta_ts>2014-07-07 06:31:26 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>CSS</product>
          <component>Syntax</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://drafts.csswg.org/css-syntax/#consume-comments</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael[tm] Smith">mike</reporter>
          <assigned_to name="Tab Atkins Jr.">jackalmage</assigned_to>
          
          
          <qa_contact>public-css-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>108734</commentid>
    <comment_count>0</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2014-07-05 10:55:39 +0000</bug_when>
    <thetext>The CSS Syntax spec should either produce tokens for &quot;/*&quot; and &quot;*/&quot;, or define an unclosed comment as a parse error.

For example, I&apos;d like to have the validator produce a message to the user for a case like the following.

  sizes=&quot;(max-width: 30em) 100vw, /* comment I forgot to close (max-width: 50em) 50vw, calc(33vw - 100px)&quot;

But the problem is, using a tokenizer conforming to the CSS Syntax spec (or writing one myself), I have no way at all to expose that comment to the validator -- and so, no way to report it to the user.

If a conforming tokenizer produced tokens for &quot;/*&quot; and &quot;*/&quot;, I&apos;d be able to expose the lack of a &quot;*/&quot; to the validator and report it to the user. Alternatively, if the &quot;Consume comments&quot; algorithm in the Syntax spec explicitly defined a parse error for the case of an unclosed comment, I wouldn&apos;t need the comment tokens -- I could just have the validator code catch that error reported by the tokenizer.

To be clear, I&apos;m not suggesting that any UA behavior around this should change. I&apos;m not proposing that an unclosed comment should be fatal and cause parsing to fail. I&apos;m just suggesting it could be a &quot;parse error&quot; in the particular technical sense in which that term is defined in the spec at http://drafts.csswg.org/css-syntax/#parse-error</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108735</commentid>
    <comment_count>1</comment_count>
    <who name="L. David Baron (Mozilla)">dbaron</who>
    <bug_when>2014-07-05 14:56:55 +0000</bug_when>
    <thetext>Could it be a tokenization error instead of a parse error?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108738</commentid>
    <comment_count>2</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2014-07-05 21:39:01 +0000</bug_when>
    <thetext>(In reply to L. David Baron (Mozilla) from comment #1)
&gt; Could it be a tokenization error instead of a parse error?

Yeah ideally it should be a tokenization error rather than a parse error -- to the degree that the spec actually makes it possible to define tokenization errors separately.

In other words, it should be possible to catch this case just using a conforming tokenizer, without needing a conforming parser.
 
But as far as I can see the current spec doesn&apos;t actually define any tokenization errors as such.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108744</commentid>
    <comment_count>3</comment_count>
    <who name="Tab Atkins Jr.">jackalmage</who>
    <bug_when>2014-07-07 02:48:51 +0000</bug_when>
    <thetext>&gt; Yeah ideally it should be a tokenization error rather than a parse error -- to the degree that the spec actually makes it possible to define tokenization errors separately.

I&apos;ve gone ahead and flagged it as a parse error.  (It happens during tokenization, but I don&apos;t feel like it&apos;s important to distinguish in the spec between a term for &quot;errors during tokenization&quot; and &quot;errors during parsing&quot;.)

&gt; In other words, it should be possible to catch this case just using a conforming tokenizer, without needing a conforming parser.

Comments disappear during tokenizing anyway; parsing has an allowance for keeping them around, but requires that they be ignored for the purpose of actually running the parser.

&gt; But as far as I can see the current spec doesn&apos;t actually define any tokenization errors as such.

Didn&apos;t think any were needed (CSS doesn&apos;t have very much in the way of error-correction, just error-recovery and auto-closing of things at EOF), but let me know if there&apos;s anything obvious I can add that&apos;ll make it easier for you.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>